开发者

ASP.NET Checkboxes/RadioLists Arrow Keys

I have an ASP.NET web application for data entry, and开发者_开发技巧 we have big lists of radiobuttons, and long lists of checkboxes, in some sections.

The client wants to be able to be able to navigate and manipulate these controls with their keyboard, like the tab/space/enter/right-left-up-down-arrow-keys. Are there any ASP.NET controls that I can use?


You could use the TabIndex property and AccessKey properties of controls. The TabIndex will allow for in order navigation of controls using the Tab key. The AccessKey property can be used to set a specific keyboard letter to access the input field.

Using Jquery, you could use the .keypress() event to detect if the up/down key was press (See this for some hints). Then when used in conjunction with the TabIndex property, you could set focus to the next/previous input field.


This could be accomplished but it requires a bit of coding. You may have to add a keyup event to the body and handle the keys. I did the same for Jquery UI Tabs (right and left keys). You can use the concept to accomplish your stuff.

http://ctrlshiftb.wordpress.com/2010/02/03/how-to-add-keyboard-navigation-for-jquery-ui-tabs/

Hope this helps.

Thanks, Raja


I may have misunderstood the question but if you set focus e.g.

RadioButtonList1.Focus(); 

keyboard shortcuts e.g. arrow-keys/space etc are available as standard behavior?

If you want more complex functionality you could add javascript attributes to you controls. This link is useful link text

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜