New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Defining the Structure in the Code-Behind

RadMultiPage can be easily created dynamically(in the codebehind).

The PageViewCreated event is fired for each page view added to the RadPageViewCollection of the RadMultiPage . The PageViewCreated event fires on every postback. This is the best place to add controls to the Controls collections of the page views.

The ID s of controls that are added to the Controls collection of page views should be set on each postback to the same value. Otherwise, different IDs will be set to these controls on each postback and this can lead to ViewState problems.

C#
protected void Page_Load(object sender, System.EventArgs e)
{
 if (!Page.IsPostBack)
 {
   AddTab("Corporate");
   AddTab("Personal");
 }
}
private void AddTab(string tabName)
{
 RadTab tab = new RadTab();
 tab.Text = tabName;
 RadTabStrip1.Tabs.Add(tab);
 RadPageView pageView = new RadPageView();
 pageView.ID = tabName;
 RadMultiPage1.PageViews.Add(pageView);
}

protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
 string userControlName = e.PageView.ID + "CS.ascx";
      
 Control userControl = Page.LoadControl(userControlName);
 userControl.ID = e.PageView.ID + "_userControl";
      
 e.PageView.Controls.Add(userControl);
} 	

See a live example at: Dynamic RadPageView

Not finding the help you need?
Contact Support