- Nothing
- It will trigger the first button the page encounters (which may not be the button event you want to trigger).
Another approach is to use javascript to do that.
The java script is as follows:
function clickButton(e, buttonid){
var bt = document.getElementById(buttonid);
if (typeof bt == 'object'){
if(navigator.appName.indexOf("Netscape")>(-1)){
if (e.keyCode == 13){
bt.click();
return false;
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
if (event.keyCode == 13){
bt.click();
return false;
}
}
}
}
Then register the textbox you want to link to the javascript as follows in the codebehind:
txtLotID.Attributes.Add("onkeypress", "return clickButton(event,'" + btnLotID.ClientID + "')")
This is useful for a web page for performing stock take where you use a scanner to scan the lots or serial number into the textbox and the scanner automatically performs enter.
No comments:
Post a Comment