|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Referencing controls inside Wizard controlHi 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. Use:
TextBox textBox1 = WizardStep1.CustomNavigationTemplateContainer.FindControl("TextBox1") as TextBox; -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > 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. > 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/ Show quoteHide quote "James Bond" <JamesB***@discussions.microsoft.com> wrote in message news:6AA343AB-2433-43A0-AA27-9C190F7A8A0F@microsoft.com... > 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. 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 Show quoteHide quote > 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" <JamesB***@discussions.microsoft.com> wrote in message > news:6AA343AB-2433-43A0-AA27-9C190F7A8A0F@microsoft.com... > >> 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. 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 Show quoteHide quote "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message news:b8743b1163f0d8c7dc1bff33cb7a@msnews.microsoft.com... > 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" <JamesB***@discussions.microsoft.com> wrote in message >> news:6AA343AB-2433-43A0-AA27-9C190F7A8A0F@microsoft.com... >> >>> 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. > > I'm wondering how to get a reference to the Next / Prior buttons so that I
can duplicate them in my button controls. When I click my Next button, I want to fire the Wizard's next... Show quoteHide quote "Brock Allen" wrote: > 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" <JamesB***@discussions.microsoft.com> wrote in message > > news:6AA343AB-2433-43A0-AA27-9C190F7A8A0F@microsoft.com... > > > >> 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. > > > Try with this method, which gets a reference to an arbitrary control placed
at an arbitrary level in the Page hierarchy by its ID (call it by passing a reference to your Wizard control's ControlCollection property) public static Control FindControl(string controlID, ControlCollection controls) { foreach (Control control in controls) { if(control.ID == controlID) return control; if(control.HasControls()) { Control nestedControl = FindControl(controlID, control.Controls); if(nestedControl != null) return nestedControl; } } return null; } -- Show quoteHide quoteSimone Busoli "James Bond" wrote: > 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.
programmatically copy table to another application
What functionality does Infragistics controls offer, which don't come with VS .NET 2005? grid postback newbie to creating web controls Closing window/page Datagrid Listbox is overlapping the Textbox in Asp.net Basic formatting for HTML text in ASP.NET 1.1 ? Adding a Directive to a dynamically created Template Column on gri add dynamically multiple controls into one panel |
|||||||||||||||||||||||