function fnEnterkey(e) {
if (e.keyCode == "13") {
var button = document.getElementById("<%=lnkButton.ClientID%>");
if (button.dispatchEvent) {
var e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);
if (button.dispatchEvent(e))
{ __doPostBack("<%=lnkButton.UniqueID %>"); }
return false;
}
else {
button.click();
return false;
}
}
}
........
<asp:Panel ID="pnlButton" runat="server" DefaultButton="lnkButton" onkeypress="return fnEnterkey(event);">
<asp:LinkButton ID="lnkButton" Text="Search" runat="server" CausesValidation="false"
OnClientClick="return CheckEmptyQuery();" OnClick="lnkButton_Click" CssClass="LButton"></asp:LinkButton>
…..
</asp:Panel>
........
No comments:
Post a Comment