Load user control from another user control in a RadTabStrip

Go To StackoverFlow.com


I am using Telerik Rad tabstrip control in which I am loading two user controls A, B. Now from User Control A , I want to load or call or redirect to User Control B with some query string parameters.

How can I do it ?

Below is markup:

 <telerik:radtabstrip id="RadTabStrip1" runat="server" skin="Black" 
multipageid="rmpProgressReports" selectedindex="0" cssclass="tabStrip" OnTabClick="RadTabStrip1_TabClick">
                <telerik:RadTab Text="DASHBOARD" PageViewID="rpvDashBoard" TabIndex="0" Selected="True" SelectedCssClass="SelectedTab">
                <telerik:RadTab Text="REPORT DETAILS" PageViewID="rpvReportDetails" TabIndex="1" SelectedCssClass="SelectedTab">
<telerik:radmultipage id="rmpProgressReports" runat="server" selectedindex="0">
            <telerik:RadPageView ID="rpvDashBoard" runat="server" TabIndex="0">
            <uc1:PRDashBoards ID="PRDashBoards" runat="server" />
            <telerik:RadPageView ID="rpvReportDetails" runat="server" TabIndex="1">
            <uc2:PRDetails ID="PRDetails" runat="server" />
2012-04-04 17:59
by msbyuva


[begin edit]

On your Primary control, you could make an event handler. When you want to execute that event handler from the primary control (on button click for example) it will execute the code on the sending page.

Declare the custom Event Handler

public delegate void ControlChangedEventHandler(string QueryString);

Then in my your second control, delcare a public eventhandler for the change:

public ControlChangedEventHandler OnControlChanged;   

Then on submission of your control, check to see if OnControlChanged has been set and then execute.

    if (OnControlChanged != null)

Now in your main control, create a function to handle the work

public void OnControlChanged(string QueryString)
    RadTabStrip1.SelectedIndex = 1;
    rmpProgressReports.SelectedIndex = 1;

and then assign that function as the event handler for the OnAddressChanged for the usercontrol.

PRDashBoards.OnControlChanged += new ControlChangedEventHandler(OnControlChanged);

[old answer based on clicking on the tabs]

You can set the AutoPostBack property of the RadTabStrip to True to allow the OnTabClick function to fire.

From inside of the OnTabClick function, you can access a public property or function of the UserControl and pass data to it, for example, creating a public function to then cause the data to be rebound based on a parameter. For example:

protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    if (e.Tab.TabIndex == 0)
    else if (e.Tab.TabIndex == 1)
2012-04-05 21:22
by KRichardson
Thanks for the response, well in my case RadTabStrip1_TabClick can not be used. User Control A has a grid, when clicked on grid view, I want to load or call or redirect to User Control B with some query string parameters - msbyuva 2012-04-09 13:12
not sure if editing also tags an update on your end like a comment does, but I have edited in a solution that should work for you - KRichardson 2012-04-09 16:50
Thanks nurgent.. it helped me to get what I need..! - msbyuva 2012-04-10 13:25