When user presses enter...
Ok im having a problem that seems so simple, but i am just unable to find an answer by searching...
Basically what im trying to do is make it so when the user presses enter on the keyboard it presses a certain button on the page. For Example: The user types in their username and password and presses enter, this clicks the "login" button rather than multiple other buttons on the webform. The answer to this would solve half of my problem.
The other half is, i need to click a link in the datagrid when the user presses enter, for example: The user clicks edit, then starts typing in the textbox they need edited, when they are done most users will probably hit the enter key so i would like this to click the Update link in the datagrid, or the alternative of just doing nothing, if clicking update is not possible or very difficult.
I am using VS 2003, C# Webform :afrog:
Re: When user presses enter...
You could set a event handler on the keys, and when the user click the enter key, simply call the method for the event handler as of the button.
Re: When user presses enter...
I guess it's the "DefaultButton" property
HTML Code:
<form id="form1" runat="server" defaultbutton="Button1">
Re: When user presses enter...
I dont think that works for a webform, because there is nothing close to that in the properties window :(
also... is that vs 2005? :)
Re: When user presses enter...
sorry, didn't read your entire post
updated
Re: When user presses enter...
sorry, didnt see it was a webform - jen
Re: When user presses enter...
kewl ill try that out on tuesday when i get back in the office, thx guyz
Re: When user presses enter...
WebForms questions go in the ASP.NET forum.
The submit button is the default. That is all that the DefaultButton property controls.
Re: When user presses enter...
welp, turns out i dont have that option for "defaultbutton="Button1"" :(
Re: When user presses enter...
Quote:
Originally Posted by HardD99
welp, turns out i dont have that option for "defaultbutton="Button1"" :(
Sorry, it seems to be a new feature in v2.0 that doesn't exist in 1.1
I guess you'll have to go JenniferBabe's way