>Hi everybody,
>
>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.
You can't access a control inside of a user control this way. Inside of the formview, FindControl can only find the name of the user control. FindControl is not recursive - it doesn't drill into contained control collections. I would suggest changing your user control to expose a method which allows you to set focus to this control. Then use code similar to what you're doing above to find your user control instead. Once you've found it, call this method.