I am planning to use FontAwesome icons in my asp.net webforms websites. The problem is that in many cases, the images are set dynamically from the code behind using asp:ImageButton using the ImageUrl property. Since FontAwesome uses either
As FontAwesome is a font that requires HTML elements to display, neither
<asp:ImageButton /> (only allows images) nor
<asp:Button /> (only allows plain text) are suitable. You are better off using a
HtmlButton Remarks: The HTML 4.0 <button> element enables you to create buttons composed of embedded HTML elements (and even other Web Forms controls).
<button id="btnSearch" runat="server"><i class="fa fa-search"></i> Search</button>
Read more: HtmlButton Control