Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting a default command button
Message
From
30/01/2004 19:04:05
 
 
To
29/07/2003 13:27:32
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00814142
Message ID:
00872591
Views:
11
I was thrilled to see this message thread about defaulting the ENTER key to the click event of a button. I however have 2 web forms that contain only 1 textbox each. This trick only works when a form is populated with more thatn 1 textbox. Are you aware of any technique for defaulting the ENTER keypress that works when a form only has 1 textbox.

Thanx,
Neil

>Thanks, that did it.
>
>Jerry
>
>
>
>>Jerry,
>>
>>Sorry seemed to skip that snippet of information ;-) However, the whole issue of focus on webforms is quite the can of worms. There are a number of solutions available all with various issues associated with them, but one works pretty much all of the time (except for a curious bug when there is only one textbox on a form?).
>>
>>private void Page_Load(object sender, System.EventArgs e)
>>{
>>// This causes the page to associate Enter key with btnSearch click.
>>Page.RegisterHiddenField( "__EVENTTARGET", "btnSearch" );
>>}
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform