This is my asp:button code which is not rendering font awesome's icon but instead shows the HTML as it is:
<asp:Button runat="server" ID="btnRun" Text="<i class='icon-camera-retro'></i> Search" ValidationGroup="edt" OnClick="btnRun_Click" CssClass="greenButton"/>
Any idea how can I solve this issue?
Adding icon in Button For example, you can render the desired icon in the button by using the following table that contains the listed icons' CSS class names in the “PrefixIcon” property of button component. Also, use “ContentType” property to display the icon in the button.
Solution: First, open the extensions sidebar ( Ctrl+Shift+X ) and search for "font awesome auto" to locate and install the extension. When the installation is complete, the function will be activated immediately. Type "fa-" in your HTML file, and the auto-complete menu will be displayed.
You can't with the default asp.net button you will need to use a HTML button and give it runat=server attribute:
<button runat="server" id="btnRun" class="btn btn-mini" title="Search"> <i class="icon-camera-retro"></i> Search </button>
So use code behind with this you add:
onserverclick="functionName"
To the button, then in your C# do:
protected void functionName(object sender, EventArgs e) { Response.Write("Hello World!!!"); }
So final button looks like:
<button runat="server" id="btnRun" onserverclick="functionName" class="btn btn-mini" title="Search"> <i class="icon-camera-retro"></i> Search </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