asp按钮里面的字体真棒 [英] Font awesome inside asp button

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

问题描述

这是我的 asp:button 代码,它没有呈现字体真棒的图标,而是按原样显示 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=server 属性:

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" 

到按钮,然后在你的 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天全站免登陆