1

I have asp.net website. Here I have not used form tag for designing page but used div tags.

Now i want to read the key combination from user, example: if user presses keys "s+u+m" then I have to generate OnClick event of Sum Button on my ASPX page. But it should be happen at page level not for control's key press

Also if there is an JS then please tell me where to write it as I am new in ASP.Net Any Idea???

Thanks.

Vijay
  • 81
  • 1
  • 4
  • 14
  • possible duplicate http://stackoverflow.com/questions/5203407/javascript-multiple-keys-pressed-at-once – Buzz Aug 21 '12 at 08:39

1 Answers1

0

You can achieve this by control's AccessKey property. But it will only allow 'Alt + Key' combination as you want PostBack on the key press.

<form id="form1" runat="server">
<div>
    <asp:Button ID="Button1" runat="server" Text="Button" AccessKey="P"
        onclick="Button1_Click" />
</div>
</form>

'Alt + P' key combination on page will fire Button1_Click event.

If you want to make any key refer - js-hotkeys jquery plugin

Example: Binding 'Ctrl+P'

$(document).bind('keydown', 'ctrl+c', fnKeyCaptured);

function fnKeyCaptured()
{
    __doPostBack(button.id,"OnClick");
}
Parag Meshram
  • 8,281
  • 10
  • 52
  • 88