Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting focus to the control on the page (AJAX site)
Message
From
22/02/2008 05:07:37
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01294462
Message ID:
01295267
Views:
31
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everybody,
>>>
>>>I tried to just set a DefaultFocus property of the page to the name of my control (inside the LoginView) but it doesn't work.
>>>
>>>Here is the link I found http://www.beansoftware.com/ASP.NET-Tutorials/Focus-ASP.NET.aspx
>>
>>There are three different suggestions there. Which did you try?
>>
>The simplest of setting DefaultFocus property for the form. My next take would be to try JavaScript code, but I hoped the DefaultFocus would be enough.

Setting DefaultFocus in the markup works for me. Also
 Page.Form.DefaultFocus = "textbox";
// or safer:
Page.Form.DefaultFocus = textbox.ClientId;
in the Page load has the same effect. In either case the following javascript is generated in the form tag of the HTML:
<script type="text/javascript">
//<![CDATA[
WebForm_AutoFocus('textbox');//]]>
</script>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform