I'm trying to include an <i>
for the Text attribute for an asp button but it's just rendering the html as text...
<asp:Button runat="server" ID="modify" ToolTip="Modify" CssClass="btn btn-mini" OnClick="modify_Onclick" Text='<i class="icon-edit"></i>' />
I've got to be over thinking this...
EDIT: I'm using the twitter bootstrap framework. That's why the <i>
tag. Here's an example: http://twitter.github.com/bootstrap/base-css.html#icons
The <button> element is used to create an HTML button. Any text appearing between the opening and closing tags will appear as text on the button. No action takes place by default when a button is clicked. Actions must be added to buttons using JavaScript or by associating the button with a form.
The <button> tag defines a clickable button. Inside a <button> element you can put text (and tags like <i> , <b> , <strong> , <br> , <img> , etc.). That is not possible with a button created with the <input> element!
asp:Button is an asp.net server control which fire an event on the server side. <input id="Submit1" type="submit" is a client side button of type submit, but it can act as a server side button as well by adding. runat="server" and onserverclick="eventname"
You can use <asp:LinkButton
. Bootstrap renders anchor tags (asp:LinkButton) like input type submit buttons (asp:Button).
<asp:LinkButton runat="server" ID="modify" ToolTip="Modify" CssClass="btn btn-mini" OnClick="modify_Onclick" Text='<i class="icon-edit"></i>' />
What I ended up doing was going with an html button, runat=server
and putting the <i>
inside of that.
<button runat="server" id="modify" class="btn btn-mini" title="Modify" onserverclick="modify_Onclick"> <i class="icon-edit"></i> </button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With