Reputation: 109
How to put underline for first letter for access key for ?
Upvotes: 6
Views: 6213
Reputation: 3665
asp:buttons are output as html "input" tags with a type of "submit". The text displayed on them is output in the "value" attribute of the tag, and so cannot contain any styling or html. If you could get an asp:button to output as an html button then you could try something like:
<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");
}
Upvotes: 4
Reputation: 338138
Tried the AccessKey attribute?
<asp:button id="Button1" runat="server" Text="Print" AccessKey="P" />
If it is really underlined is out of your control. The user agent (e.g. browser) is deciding that.
Upvotes: 0