Link to home
Start Free TrialLog in
Avatar of Xignal76
Xignal76

asked on

How to set focus to a textbox in a C# Wizard step inside an UpdatePanel

Tried many methods to place the cursor in a textbox in Wizard steps in a VS 2005 Wizard control. The control is inside an UpdatePanel. I can use a FindControl to identify the control successfully but the focus always defaults to the Step's Next button. My most recent code attempt is below. Suggestions?
//Called from an OnPreRender = "Wizard1_PreRender" statement in asp:Wizard
 
protected void Wizard1_PreRender(object sender, EventArgs e)
    {
        if (Wizard1.ActiveStep.Name == "Step 2")
        {
            TextBox textbox = (TextBox)Wizard1.FindControl("txtUserFirstName");
            Page.SetFocus(textbox);
        }
    }

Open in new window

SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Xignal76
Xignal76

ASKER

Had, but did it again just to be sure. Same result - the Next button got focus.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial