Defauly focus in a WizardStep

Discussion in 'ASP .Net Web Controls' started by David Thielen, Feb 27, 2007.

  1. David Thielen, Feb 27, 2007
    #1
    1. Advertising

  2. Hello Dave,

    As for the focus in web page, the whole page wil only have a single focus.
    So if you put wizard control on the page, those child controls in
    wizardsteps also share this page focus. If you want to make a certain sub
    control in your wizard control(in a certain wizardstep) get focus. You can
    consider use Wizard control's Prerender event to get the control's
    reference and then call Page.SetFocus against it. e.g.


    ==========aspx template==============
    <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" Height="135px"
    Width="602px" OnPreRender="Wizard1_PreRender1">
    <WizardSteps>
    <asp:WizardStep runat="server" Title="Step 1">
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </asp:WizardStep>
    <asp:WizardStep runat="server" Title="Step 2"
    OnPreRender="Wizard1_PreRender">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    <asp:LinkButton ID="LinkButton1"
    runat="server">LinkButton</asp:LinkButton>
    <asp:ImageButton ID="ImageButton1" runat="server" />
    <asp:DropDownList ID="DropDownList1" runat="server">
    <asp:ListItem>aaa</asp:ListItem>
    <asp:ListItem>bbb</asp:ListItem>
    <asp:ListItem>ccc</asp:ListItem>
    </asp:DropDownList>
    </asp:WizardStep>
    <asp:WizardStep runat="server" StepType="Finish"
    Title="Step 3">
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
    </asp:WizardStep>
    </WizardSteps>
    </asp:Wizard>

    ============code behind==========

    protected void Wizard1_PreRender1(object sender, EventArgs e)
    {
    if (Wizard1.ActiveStepIndex == 1)
    {
    Control control =
    Wizard1.WizardSteps[1].FindControl("DropDownList1");

    Page.SetFocus(control);
    }
    }

    ==================

    Hope this helps.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Feb 28, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    420
  2. =?Utf-8?B?Y2xpY2tvbg==?=
    Replies:
    1
    Views:
    2,761
    =?Utf-8?B?Y2xpY2tvbg==?=
    Apr 10, 2006
  3. Michel Couche
    Replies:
    0
    Views:
    956
    Michel Couche
    Oct 20, 2006
  4. =?Utf-8?B?TWlrZQ==?=

    Changing position of Wizardstep

    =?Utf-8?B?TWlrZQ==?=, Sep 3, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    529
    Michael Nemtsev, MVP
    Sep 3, 2007
  5. Roger
    Replies:
    3
    Views:
    351
Loading...

Share This Page