字体真棒内ASP按钮 [英] Font awesome inside asp button

查看:168
本文介绍了字体真棒内ASP按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的ASP:按钮code这是不渲染字体真棒图标,而是显示HTML,因为它是:

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?

推荐答案

您不能使用默认asp.net按钮,您将需要使用一个HTML按钮,并给它RUNAT =服务器属性:

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>

因此​​,与此背后使用code添加:

So use code behind with this you add:

onserverclick="functionName" 

要的按钮,然后在C#做的:

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>

这篇关于字体真棒内ASP按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆