We all need to set a default button on an asp.net page. There are few options too but with some limitations. As for e.g. we have an option to call click method of javascript and another option is set DefaultButton property of an asp.net panel but both would not work in firefox. To run default button or call any button on enter key will work as below:
<asp:TextBox ID=”txtUserLogon” runat=”server” Style=”display: none” ValidationGroup=”SearchUser”
onkeypress=”searchKeyPress(event);”></asp:TextBox>
function searchKeyPress(e)
{
if (window.event) { e = window.event; }
if (e.keyCode == 13) {
var b = document.getElementById(‘<%= lnkSearch.ClientID %>’);
if (b && typeof (b.click) == ‘undefined’) {
b.click = function() {
var result = true;
if (b.onclick) result = b.onclick();
if (typeof (result) == ‘undefined’ || result) {
eval(b.getAttribute(‘href’));
}
}
}
}
}
Help from: http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/