Tuesday, May 3, 2011

How do I make a key binding/shortcut for an ASP.NET button to postback via that button?

I'm developing what's intended to be a very efficient UI in ASP.NET.

I want my users to be able to hit ALT-A to postback the form via a particular button. In other words, when they hit "ALT A" the form will post back and the event handler/function associated with a particular ASP.NET button control will run.

How can I do this? I have ASP.NET 2.0/3.5. I also have the Telerik control set at my disposal.

-KF

From stackoverflow
  • Use the "accesskey" attribute in HTML.

    <input type="submit" accesskey="a" value="Submit">
    <asp:Button AccessKey="a" runat="server" ....
    
    kendor : Perfect solution, easy and thanks!

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.