there are two ways of getting to navigate with the enter key. one is using the panel control's property "DefaultButton".
here's the function that would detect the enter key:
>> body onkeydown='ManageKeyDown'
function ManageKeyDown(e)
{
var code;
if(window.event) // for IE
{
code= e.keyCode;
}
else if(e.which) // for Netscape/Firefox/Opera
{
code= e.which;
}
if (code== 13) // if it's the enter key
{
alert(code);
//here goes the implentation necessary to execute a button
document.getElementById("button1").click();
}
}
this is another way, which is a bit more flexible, and works with ajax. while the defaultButton property of a panel may not work with the update panel (from my experience with this technique).
No comments:
Post a Comment