Reputation: 5
I'm developing a web application that displays items from a work queue to a user. When an item is selected I have the app lock that item out so no other user can select it. By hitting the back button in the app it unlocks the item.
I want to be able to unlock the item if the user hits the backspace key. I know what code I need to unlock it. I just need to know how to make the code execute on backspace key stroke.
The code that I need to execute will be server side code.
Thanks in advance.
Upvotes: 0
Views: 366
Reputation: 460138
<script>
document.onkeydown = function (e)
{
if (window.event && window.event.keyCode == 8) {
__doPostBack('__Page', 'MyCustomArgument');
}
}
</script>
If you need to execute code on server, you have to change your question accordingly
EDIT:
I changed the above code, but i think your next question could be how you should know which item was selected, won't it? Then you have to clarify what items we are talking about. On serverside you get the passed arguments with:
If Page.IsPostBack Then
Dim eventArg As String = Request("__EVENTARGUMENT")
End If
End If
Upvotes: 2