Solved

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

Posted on 2009-04-15
3
1,104 Views
Last Modified: 2013-12-17
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

0
Comment
Question by:Xignal76
  • 2
3 Comments
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 250 total points
ID: 24157533
Did you try textbox.Focus()?
0
 

Author Comment

by:Xignal76
ID: 24157700
Had, but did it again just to be sure. Same result - the Next button got focus.
0
 

Accepted Solution

by:
Xignal76 earned 0 total points
ID: 24159575
Figured out a workaround.

It works if you do not put the Wizard inside a single UpdatePanel, but instead place an UpdatePanel inside each WizardStep. The focus then gets set correctly.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question