If you want to set default button page wise , you can use "DefaultButton" Property for Html Form Control.
Syntax :
Example :
You can also set multipe Default button means region wise Default button in one page.
For that you use asp:Panel control.
you can use "DefaultButton" Property of asp:Panel control.
Example :
and When your cursor on btnSearch textbox and you hit enter at that time btnSearch button click event call.
Syntax :
DefaultButton="button id"
Example :
<form id="frm" DefaultButton="btnSave" runat="server">
.....
</form>
In this when you hits the enter key the click event of btnSave button get clicked......
</form>
You can also set multipe Default button means region wise Default button in one page.
For that you use asp:Panel control.
you can use "DefaultButton" Property of asp:Panel control.
Example :
<asp:Panel runat="server" ID="Panel1" DefaultButton="btnSave">
<asp:TextBox runat="server" ID="txtSave"></asp:TextBox>
<asp:Button runat="server" ID="btnSave" Text="Save" />
</asp:Panel>
<asp:Panel runat="server" ID="pnlSearch" DefaultButton="btnSearch">
<asp:TextBox runat="server" ID="txtSearch"></asp:TextBox>
<asp:Button runat="server" ID="btnSearch" Text="Search" />
</asp:Panel>
In this when your cursor on txtSave textbox and you hit enter at that time btnSave button click event call,<asp:TextBox runat="server" ID="txtSave"></asp:TextBox>
<asp:Button runat="server" ID="btnSave" Text="Save" />
</asp:Panel>
<asp:Panel runat="server" ID="pnlSearch" DefaultButton="btnSearch">
<asp:TextBox runat="server" ID="txtSearch"></asp:TextBox>
<asp:Button runat="server" ID="btnSearch" Text="Search" />
</asp:Panel>
and When your cursor on btnSearch textbox and you hit enter at that time btnSearch button click event call.
No comments:
Post a Comment