Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reload page when user enters info in textbox?
Message
 
To
29/04/2008 13:18:52
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01313951
Message ID:
01314155
Views:
7
>Well, I got lucky again...
>
>All I did was add a button to the table and set the Text to "Search" and WOW it updates the form when I click it, AND it updates the page if I just hit ENTER. It's magic.
>
>
>                <td>
>                    <asp:Button ID="Button1" runat="server" Text="Search" />
>                </td>
>
>
>Now I've gotta go figure out WHY this worked, and if this is the right way to depend on it working...
>
>

A button by default is a normal HTML "Submit" button. That means it that when you hit enter, a postback is forced (the page is submitted via a POST operation). More specifically, it is rendered as:
<input type="submit" name="Button1" value="Search" id="Button1" />
The next question you then tend to see is, "How do I stop the page from automatically posting back when I hit enter? I want my normal desktop behavior where enter moves to the next control". The answer is to set the property "UseSubmitBehavior" on the control to false, ex:
<asp:Button ID="Button1" runat="server" Text="Search" UseSubmitBehavior="false" />
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform