Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing first control of the FormView
Message
From
19/06/2008 09:28:15
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01325311
Message ID:
01325406
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Hi Naomi,

>
>I have a FormView with UserControls inside. I want to be able to set focus to the FirstControl in the FormView (BTW, this control in the ReadOnly mode).
>
>I tried
>
>TextBox txt = currentForm.Row.FindControl("txtFirstName") as TextBox;
>            if (txt != null)
>                txt.Focus();
>            else
>                currentForm.Row.Focus();
>
>txtFirstName is a first control in the General User Info user control.
>
>I only got the else part executed.
>
>Any ideas how can I set focus to the first control?
>
>Thanks a lot in advance.

Wouldn't you have to put a method in your user control to do this? I am guessing as I am not too sure of your situation, but I doubt the FindControl would actually find a control within your user control.
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform