I looked through and through and found no clean solution for this. A colleague of mine did find a pretty dirty solution but I don't see why the solutions in the links reference below does not work when I place it in a master page. I have a master page that basically has a textbox and a linkbutton, when I hit the enter key, the default button for the child page gets called instead.
- http://weblogs.asp.net/jeff/archive/2005/07/26/420618.aspx
- set linkbutton as default button for asp:panel in asp.net (Ahmad's Solution)
any insight on this please? thanks :)
I will post the dirty solution when I get to work tomorrow.
EDIT: here's the dirty (i think) solution:
string id = ctlToClick.UniqueID;
string someJavascript = //see below
EmailTextBox.Attributes.Add("OnKeyPress", someJavascript);
The javascript (placed it here so StackOverflow can format it better):
javascript:if (window.event){
if(parseInt(window.event.keyCode) == 13){
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('" + id + "', '', true, 'Login', '', false, true));
return false;
}
}
Is this really the only solution for this?