Sunday, August 9, 2009

To Create an Corresponding Button Event by Hitting on Enter key

I will show you simple tip how to create an event by hitting on enter key after writing some text in corresponding textbox without conflicts in other events
Say if you have two textboxes and corresponding buttons, in which you write text to textbox of the two, corresponding button event should fire when enter key is hit


<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" DefaultButton="Button2">
<asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" Style="height: 26px" />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:Panel>




Savings are achieved when the power switch is off

No comments:

Post a Comment