Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus to textbox control
Message
From
18/08/2003 21:45:58
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
 
 
To
All
General information
Forum:
ASP.NET
Category:
Mobile development
Title:
Setfocus to textbox control
Miscellaneous
Thread ID:
00821258
Message ID:
00821258
Views:
60
I would like a textbox to have focus at the start of the
application.

How would I code this? Im still trying to figure this one
out.

Im developing an asp.net mobile web application, c#
vs 2003.


The code below is what I have used. It does not seem to setfocus to the asp.net textbox.
I have also tried your code with c# language modifications. This also does not set focus to the textbox. Please let me know if I have a coding issue.
StringBuilder strBuilder = new StringBuilder(); 

strBuilder.Append("<script language = 'javascript'>"); 

strBuilder.Append("document.forms.MobileWebForm1.txtBarCodeReader.focus();"); 

strBuilder.Append("document.forms.MobileWebForm1.txtBarCodeReader.select();"); 



strBuilder.Append("</script>"); 

RegisterStartupScript("Focus",strBuilder.ToString()); 
Thanks
Alvin
Next
Reply
Map
View

Click here to load this message in the networking platform