This is a migrated thread and some comments may be shown as answers.

Populate Properties of User Controls in Wizard Demo

2 Answers 95 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 29 Dec 2009, 06:21 PM
Hello,

I'm following the Wizard demo to create a Wizard using RadTabStrip and RadMultiPage. I have a RadComboBox that the user will select a value from that needs to be passed to each control as it is loaded so that the correct data is loaded/saved. Normally I would have the control declared on the page and then just set the properties in code, ie:

Normally the control is declared in markup like this:
<MyControls:GroupSelector runat="server" id="GroupSelectorControl"
GroupSelector.GroupNumber = "0003" 
Then I would just set the property in code like the above snippet...

However, with the Wizard example the controls are being dynamically loaded so I'm not sure how to pass what the user has selected from the RadComboBox to the individual controls that populate the tabs. I suppose I could use a session variable but would prefer to just set a property on the control so the control is more reusable.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Jan 2010, 08:32 AM
Hi Joe,

I assume you have the RadComboBox control in the default aspx page. In that case, you can access it from any user control using the Page.FindControl() method. For example suppose you want to prepopulate the address textbox of the Education user control:

EducationCS.ascx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            RadComboBox combo1 = Page.FindControl("RadComboBox1") as RadComboBox;
            addressTextBox.Text = combo1.SelectedItem.Text;
        }


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Atlas
Top achievements
Rank 1
answered on 18 Sep 2010, 03:00 AM
I just wanted to point out that I am doing the same thing, and your example does not work but this does:
Parent.FindControl
Tags
TabStrip
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
Peter
Telerik team
Atlas
Top achievements
Rank 1
Share this question
or