Hello,
I have a tabstrip that is created dynamically. There can be several tabs with child tabs in the tabstrip. When the user clicks on a specific tab a web user control is loaded into the selected tab. Inside one of these user controls I have a radgrid that has a grid template column with a radbutton. When the user clicks on this button I want to select a different tab and load its content based on the tab value (the tab value contains the location of the web user control that will be loaded into the tab).
I tried to do this from server-side code, but I was not able to get that to work. So, now I'm trying to get it to work using client-side code. The following javascript code almost works. It does select the tab I want to select, but it will not load the contents of the tab even though the click event is being called.
Here's my tabstrip HTML that is located inside content placeholder of a master page:
<
asp:Content
ID
=
"tabContent"
ContentPlaceHolderID
=
"cphTabStrip"
runat
=
"server"
>
<
telerik:RadTabStrip
ID
=
"rtabstripTabs"
runat
=
"server"
OnTabClick
=
"rtabstripTabs_TabClick"
ShowBaseLine
=
"true"
OnClientTabSelected
=
"OnClientTabSelected"
EnableEmbeddedSkins
=
"false"
AutoPostBack
=
"False"
MultiPageID
=
"rpageviewUserControl"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"rmpTabStrip"
runat
=
"server"
SelectedIndex
=
"0"
>
</
telerik:RadMultiPage
>
<
telerik:RadScriptBlock
ID
=
"rsbTabs"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function GetTabStrip() {
var tabstrip = $find("<%= rtabstripTabs.ClientID %>");
if (tabstrip) {
var tab = tabstrip.findTabByValue("Modules/EspsMT/Inventory/wucInventoryAddEditFilters.ascx");
tab.click();
}
}
</
script
>
</
telerik:RadScriptBlock
>
</
asp:Content
>
Here's the code in the web user control that triggers the GetTabStrip() function:
<
telerik:GridTemplateColumn
UniqueName
=
"Test"
Resizable
=
"false"
>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"btnTest"
runat
=
"server"
OnClientClicked
=
"btnTest_Clicked"
Text
=
"View Pending"
></
telerik:RadButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:RadScriptBlock
ID
=
"rsbInventoryPending"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function btnTest_Clicked(sender, args) {
window.parent.GetTabStrip();
return false;
}
</
script
>
</
telerik:RadScriptBlock
>
I tried using __PostBack() to trigger a postback. This does load the content; however, it loads the web user control twice and causes a page flash.
Can anyone help me figure out how to do this the proper way? I'd much rather do this on the server side because then I can set session variables that can be used by the second web user control content.
Thanks.