Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defaulting button for submit during grid edit
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01186064
Message ID:
01186232
Views:
19
I see about getting the button name..

Lets change this just a bit... Completely ignore the "ENTER" key from within the range of the textbox control... so NO submit is actually processed... How would you change the script for no default "ENTER" type behavior.



>>I have a webform with a grid... When user does the "select" record and it goes to edit mode, when the user enters the value and hits enter, the "default" button on the form is a link to another page instead of the "update" or "cancel" buttons... How can I force the default button during an "edit" mode.
>
>There's no concept of a default button in HTML so there's no automatic way to do this. The only way that you can do this realistically is use some java script and monitor keystrokes, then when you get an Enter key 'click' the appropriate button.
>
>Something like this:
>
>< script >
>function SubmitOnEnter(event)
>{
>  if ( event.keyCode == 13 )
>    document.getElementById('btnSubmit').click();
>
>}
></ script >
>
>
>which you can then call from any control that should submit on enter with:
>
>
><asp:TextBox runat="server" id="txtName" onkeyup="SubmitOnEnter(event)" />
>
>
>Little more work is required to get the name of the submit button though <s>...
Previous
Reply
Map
View

Click here to load this message in the networking platform