Solved

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

Posted on 2009-04-15
3
1,101 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Where to begin studying? 5 63
Data Saving 5 24
Image(2) 3 22
bulid json format 3 16
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now