Web Form:
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"radLoadingPanel"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"radTabStrip"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"radTabStrip"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"radCenterFrame"
LoadingPanelID
=
"radLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"radCenterFrame"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"radCenterFrame"
LoadingPanelID
=
"radLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
script
type
=
"text/javascript"
>
//function radTabStrip_OnClientSelecting(sender, args) {
// if (args.get_tab().get_pageViewID()) {
// alert(args.get_tab().get_test());
// args.get_tab().set_postBack(false);
// }
//}
</
script
>
<
div
>
<
telerik:RadTabStrip
ID
=
"radTabStrip"
runat
=
"server"
SelectedIndex
=
"0"
MultiPageID
=
"radCenterFrame"
OnTabClick
=
"radTabStrip_TabClick"
Orientation
=
"HorizontalTop"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"radCenterFrame"
runat
=
"server"
SelectedIndex
=
"0"
OnPageViewCreated
=
"radCenterFrame_PageViewCreated"
/>
</
div
>
Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadTab skillTab = new RadTab();
skillTab.Text = "Tab1";
radTabStrip.Tabs.Add(skillTab);
RadTab certTab = new RadTab();
certTab.Text = "Tab2";
radTabStrip.Tabs.Add(certTab);
RadTab aspTab = new RadTab();
aspTab.Text = "Tab3";
radTabStrip.Tabs.Add(aspTab);
RadTab tpTab = new RadTab();
tpTab.Text = "Tab4";
radTabStrip.Tabs.Add(tpTab);
RadPageView pageView = new RadPageView();
pageView.ID = skillTab.Text;
radCenterFrame.PageViews.Add(pageView);
skillTab.PageViewID = pageView.ID;
}
}
protected void radCenterFrame_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
string page = e.PageView.ID;
switch (page)
{
case "Tab1":
AddControl("~/_ControlTemplates/Proj/Tab1Control.ascx", e);
break;
case "Tab2":
AddControl("~/_ControlTemplates/Proj/Tab2Control.ascx", e);
break;
case "Tab3":
AddControl("~/_ControlTemplates/Proj/Tab3Control.ascx", e);
break;
case "Tab4":
AddControl("~/_ControlTemplates/Proj/Tab4Control.ascx", e);
break;
}
}
protected void radTabStrip_TabClick(object sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab);
e.Tab.PageView.Selected = true;
}
private void AddPageView(RadTab tab)
{
RadPageView pageView = new RadPageView();
pageView.ID = tab.Text;
radCenterFrame.PageViews.Add(pageView);
tab.PageViewID = pageView.ID;
}
private void AddControl(string Path, RadMultiPageEventArgs e)
{
Control userControl = Page.LoadControl(Path);
userControl.ID = e.PageView.ID + "_usercontrol";
e.PageView.Controls.Add(userControl);
}