Hi Telerik forum,
I am trying to implement ondemand property of Radmultipage using the http://demos.telerik.com/aspnet-ajax/tabstrip/examples/multipage/dynamic-pageview-creation/defaultcs.aspx. It is working some how. But what i need is i want to postback on each time when tab clicked .
For this i removed clientFunction called "onClientTabselecting".
This is where i am facing the problem. I am getting the error "Multiple controls with same ID found...." . And in my two of my viewpages contain user controls
I am getting the respective error only on re-clicking on the tab which contain user control.
My design:
Code behind:
I am trying to implement ondemand property of Radmultipage using the http://demos.telerik.com/aspnet-ajax/tabstrip/examples/multipage/dynamic-pageview-creation/defaultcs.aspx. It is working some how. But what i need is i want to postback on each time when tab clicked .
For this i removed clientFunction called "onClientTabselecting".
This is where i am facing the problem. I am getting the error "Multiple controls with same ID found...." . And in my two of my viewpages contain user controls
I am getting the respective error only on re-clicking on the tab which contain user control.
My design:
<
telerik:RadTabStrip
ID
=
"Vehicles"
runat
=
"server"
Skin
=
"Metro"
MultiPageID
=
"RadMultiPage1"
SelectedIndex
=
"0"
Width
=
"99%"
OnTabClick
=
"Vehicles_TabClick"
AutoPostBack
=
"true"
>
<
telerik:RadTab
Text
=
"Cars"
PageViewID
=
"radCars"
Value
=
"radTabCars"
> </
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Train"
Value
=
"radTabTrain"
> </
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Bus"
CssClass
=
"CustomTab"
HoveredCssClass
=
"HoveredTab"
Value
=
"radTabBus"
>
</
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Cycle"
Value
=
"radTabCycle"
> </
telerik:RadTab
>
<
telerik:RadMultiPage
ID
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
OnPageViewCreated
=
"RadMultiPage1_PageViewCreated"
EnableViewState
=
"true"
>
<
telerik:RadPageView
ID
=
"radPVCars"
runat
=
"server"
>
<
telerik:RadGrid
ID
=
"grdCars"
runat
=
"server"
AllowSorting
=
"true"
</telerik:RadGrid>
</
telerik:RagpageView
>
<
telerik:RadPageView
ID
=
"radPVTrain"
runat
=
"server"
>
<
DManagement:Fax
runat
=
"server"
ID
=
"UCTrain"
Status
=
"Train"
/>
</
telerik:RagpageView
>
<
telerik:RadPageView
ID
=
"radPVBus"
runat
=
"server"
>
<
DManagement:Fax
runat
=
"server"
ID
=
"UCcyvle"
Status
=
"Bus"
/>
</
telerik:RagpageView
>
<
telerik:RadPageView
ID
=
"radPVCycle"
runat
=
"server"
>
<
telerik:RadGrid
ID
=
"grdCycle"
runat
=
"server"
AllowSorting
=
"true"
</telerik:RadGrid>
</
telerik:RagpageView
>
Code behind:
protected void Vehicles_TabClick(object sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab);
e.Tab.PageView.Selected = true;
}
private void AddPageView(RadTab tab)
{
RadPageView pageView = new RadPageView();
if (tab.Value == "radTabCars")
{
RadMultiPage1.SelectedIndex = RadMultiPage1.FindPageViewByID("radPVCars").Index;
tab.PageViewID = "radPVCars";
return;
}
else if (tab.Value == "radTabCycle")
{
RadMultiPage1.SelectedIndex = RadMultiPage1.FindPageViewByID("radPVCycle").Index;
tab.PageViewID = "radPVCycle";
return;
}
switch (tab.Value)
{
case "radTabTrain":
pageView.ID = "radPVTrain";
break;
case "radTabBus":
pageView.ID = "radPVBus";
break;
}
RadMultiPage1.PageViews.Add(pageView);
RadMultiPage1.SelectedIndex = RadMultiPage1.PageViews.Count - 1;
tab.PageViewID = pageView.ID;
}
protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
string uControlName = "";
string uControlId = "";
switch (e.PageView.ID)
{
case "radPVTrain":
uControlName = "~/USC/UserControls/Dgmt_vehicle.ascx";
userControlId = "VehTrain";
break;
case "radPVBus":
uControlName = "~/USC/UserControls/Dgmt_vehicle.ascx";
userControlId = "VehBus";
break;
}
Control userControl1 = Page.LoadControl(userControlName);
UserControls.Dgmt_Faxes objControl = (UserControls.Dgmt_Faxes)userControl1;
if (uControlId == "VehTrain")
objControl.Status = "Train";
else if (uControlId == "VehBus")
objControl.Status = "Bus";
userControl = (VehicleUserControl)userControl1;
userControl.ID = userControlId;
e.PageView.Controls.Add(userControl);
e.PageView.EnableViewState = true;
}