Wednesday, January 20, 2010

How to create hot keys(Control keys like ctrl+S) in web application in ASP.Net?

Label Control





New: Hotkey functionality (accelerator Keys)





Explanation:


Hotkey is shortest way for user to initiate any action on Page. For instance, in Internet Explorer using “ctrl +O” brings up Open Dialog box.





Quick Implementation:


Hotkeys implemented using “AccessKey” and “AssociatedControlId” attributes.


AccessKey - shortcut letter


AssociatedControlId - control to be triggered on using AccessKey.





Sample code:


%26lt;p%26gt;


%26lt;asp:Label id=”lblUserName” Runat=”server” AccessKey=”P” AssociatedControlId=”txtUserName”%26gt;%26lt;/asp:…


%26lt;asp:TextBox Id=”txtUserName” Runat=”server”/%26gt;


%26lt;/p%26gt;





Note:


Keep in mind, that not all the letters used for this. Microsoft Internet Explorer already uses Alt+F, E, V, I, O, T, A, W, and H. If you use any of these letters, IE overrides anything used on page.








▬♂http://www.c-sharpcorner.com/Code/2005/M…How to create hot keys(Control keys like ctrl+S) in web application in ASP.Net?
You are welcome

Report Abuse

No comments:

Post a Comment