Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting focus to first control on page
Message
From
04/03/2010 08:52:13
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
04/03/2010 08:46:48
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01452441
Message ID:
01452472
Views:
28
>>>>>Hi,
>>>>>
>>>>>I have tried this code as suggested in the dev guide to set focus to a text box in the page_load:
>>>>>
>>>>>
this.FocusedControl = this.txtUsername;
>>>>>
>>>>>but it doesn't work. I have found that this works though:
>>>>>
>>>>>
this.SetFocus(this.txtUsername);
>>>>>
>>>>>Is this the correct way to do this?
>>>>
>>>>There are a couple of ways to do this. You can call the Page.SetFocus() method passing in the control ID Or you can set the DefaultFoucs property of the form.
>>>>
>>>>For some reason lately I have had issues with: this.FocusedControl = this.txtMyTextBox
>>>>It uses some javascript that continues to be an issue.
>>>>Tim
>>>
>>>hmm... I can't find a DefaultFocus property, can you tell me where that is, please? The help mentions this belongs to the form element, but I don't see a form on any of my pages. Is it called something else?
>>
>>The form is an object on the page form but in your case it is in the master so not going to be paticuraly helpful. Try just setting Page.SetFocus(this.mytextbox) in the Page Load event.
>>Tim
>
>Is Page.SetFocus() different to this.SetFocus()?

lol, guess we came full circle now that I look at your original message. :-)
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform