本文介绍了Asp.net-下划线表示按钮文本中的快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我正在使用VS 2005,framework2和c#.net,asp.net.
我已经为保存按钮实现了键盘访问键.
是Alt + s.

我想在按钮的文本中为快捷键加下划线,例如保存".
如何实现呢?

预先感谢,
George

Hi friends ,

I am using VS 2005 , framework2 and c#.net, asp.net.
I have implemented keyboard access key for save button .
It is Alt +s .

I want to underline for short cut key in the text of button like Save.
How to implement this ?

Thanks in advance,
George

推荐答案

<button id="mybutton" runat="server" onserverclick="myfunction">
<span style="text-decoration:underline;">P</span>rint</button>

and use a normal button event in your c# code:

protected void myfunction(object sender, EventArgs e)
{
        Response.Write("clicked");
}



或尝试使用AccessKey属性

< asp:button id ="Button1" runat =服务器" Text =打印" AccessKey ="P"/>



OR try with AccessKey property

<asp:button id="Button1" runat="server" Text="Print" AccessKey="P" />


这篇关于Asp.net-下划线表示按钮文本中的快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 05:02