Referencing controls inside Wizard control

Discussion in 'ASP .Net Web Controls' started by James Bond, Dec 30, 2005.

  1. James Bond

    James Bond Guest

    Hi all,

    I am having trouble referencing (directly) the controls (web) inside the
    wizard control.

    I have a templated Header control wherein I have a asp:Label. Eventhough
    the IDE shows the control in Server Objects, I am unable to reference in my
    code directly.
    James Bond, Dec 30, 2005
    #1
    1. Advertising

  2. James Bond

    Brock Allen Guest

    Use:

    TextBox textBox1 = WizardStep1.CustomNavigationTemplateContainer.FindControl("TextBox1")
    as TextBox;

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > Hi all,
    >
    > I am having trouble referencing (directly) the controls (web) inside
    > the wizard control.
    >
    > I have a templated Header control wherein I have a asp:Label.
    > Eventhough the IDE shows the control in Server Objects, I am unable to
    > reference in my code directly.
    >
    Brock Allen, Dec 30, 2005
    #2
    1. Advertising

  3. James Bond

    clintonG Guest

    Have you tried the late bound FindControl method?

    Label lbl = (Label)(WizardName.FindControl("LabelName"));
    lbl.Text = "Whatever";

    <%= Clinton Gallagher
    METROmilwaukee (sm) "A Regional Information Service"
    NET csgallagher AT metromilwaukee.com
    URL http://metromilwaukee.com/
    URL http://clintongallagher.metromilwaukee.com/



    "James Bond" <> wrote in message
    news:...
    > Hi all,
    >
    > I am having trouble referencing (directly) the controls (web) inside the
    > wizard control.
    >
    > I have a templated Header control wherein I have a asp:Label. Eventhough
    > the IDE shows the control in Server Objects, I am unable to reference in
    > my
    > code directly.
    clintonG, Dec 30, 2005
    #3
  4. James Bond

    Brock Allen Guest

    Unfortunately that doesn't work, Clinton, because of the template nature
    of the wizard. It's necessary to go to the template container for whichever
    step they need to get at:

    For the content part it's:
    _WizStep1.ContentTemplateContainer.FindControl

    For the custom navigation part it's:
    _WizStep1.CustomNavigationTemplateContainer.FindControl

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > Have you tried the late bound FindControl method?
    >
    > Label lbl = (Label)(WizardName.FindControl("LabelName")); lbl.Text =
    > "Whatever";
    >
    > <%= Clinton Gallagher
    > METROmilwaukee (sm) "A Regional Information Service"
    > NET csgallagher AT metromilwaukee.com
    > URL http://metromilwaukee.com/
    > URL http://clintongallagher.metromilwaukee.com/
    > "James Bond" <> wrote in message
    > news:...
    >
    >> Hi all,
    >>
    >> I am having trouble referencing (directly) the controls (web) inside
    >> the wizard control.
    >>
    >> I have a templated Header control wherein I have a asp:Label.
    >> Eventhough
    >> the IDE shows the control in Server Objects, I am unable to reference
    >> in
    >> my
    >> code directly.
    Brock Allen, Dec 31, 2005
    #4
  5. James Bond

    clintonG Guest

    Of course, thank you for bringing this to our attention Brock.
    I forgot the correct grammar even though I had to use "template containers"
    in my grammar when learning to reference controls in the MasterPage.

    Basically, as I am beginning to understand the 2.0 control tree, every
    nested element of an HTML template becomes a control in the control tree
    hierarchy. When referencing a "standard" control which may be located within
    a template container -- a label or textbox for example -- we must use dotted
    notation and a grammatical reference to each "template container" to
    recreate the control tree hierarchy linearly. It would be great if we had a
    "term" to refer to this grammatical process.

    And if I'm not mistaken I don't think your reminder to use correct grammar
    obviates the need for a cast. That would be correct ainna?

    What I would like to master is when to decide to use public properties for
    early bound references as I have this assumption that the use of public
    properties allows standard controls which may be located within a template
    container to be referenced directly.

    This will be important for my own first use of the Wizard control which I am
    just today finishing the HTML for and will need to access controls such as
    CheckBoxList controls and so on. If public properties would make this
    cleaner, more efficient and easier to code I'm all ears.

    <%= Clinton Gallagher


    "Brock Allen" <> wrote in message
    news:...
    > Unfortunately that doesn't work, Clinton, because of the template nature
    > of the wizard. It's necessary to go to the template container for
    > whichever step they need to get at:
    >
    > For the content part it's:
    > _WizStep1.ContentTemplateContainer.FindControl
    >
    > For the custom navigation part it's:
    > _WizStep1.CustomNavigationTemplateContainer.FindControl
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >> Have you tried the late bound FindControl method?
    >>
    >> Label lbl = (Label)(WizardName.FindControl("LabelName")); lbl.Text =
    >> "Whatever";
    >>
    >> <%= Clinton Gallagher
    >> METROmilwaukee (sm) "A Regional Information Service"
    >> NET csgallagher AT metromilwaukee.com
    >> URL http://metromilwaukee.com/
    >> URL http://clintongallagher.metromilwaukee.com/
    >> "James Bond" <> wrote in message
    >> news:...
    >>
    >>> Hi all,
    >>>
    >>> I am having trouble referencing (directly) the controls (web) inside
    >>> the wizard control.
    >>>
    >>> I have a templated Header control wherein I have a asp:Label.
    >>> Eventhough
    >>> the IDE shows the control in Server Objects, I am unable to reference
    >>> in
    >>> my
    >>> code directly.

    >
    >
    clintonG, Dec 31, 2005
    #5
    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. John R. Lewis
    Replies:
    0
    Views:
    650
    John R. Lewis
    Jan 4, 2006
  2. Replies:
    0
    Views:
    578
  3. Andy B
    Replies:
    0
    Views:
    297
    Andy B
    Apr 13, 2008
  4. Andy B
    Replies:
    0
    Views:
    424
    Andy B
    Apr 19, 2008
  5. beaudetious
    Replies:
    6
    Views:
    1,054
    James
    Jan 14, 2006
Loading...

Share This Page