Reputation: 29727
How can I make postback after user changes textbox text and hits enter ? Is only javascript real solution. Doesnt asp.net give any out from box solution for such a problem ? Thank You for any hints.
Upvotes: 1
Views: 566
Reputation: 10872
Beside the javascript solutions, you can place the textbox
with a submit button
inside a panel
and make use of DefaultButton
property of the panel.
Below is the code example: -
Your aspx will look like this
<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Panel>
Now, when you press enter inside the text box the button click event occurs, same as by clicking the button.
Upvotes: 2