New to Telerik UI for ASP.NET AJAX? Download 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.

protected void Page_Load(object sender, System.EventArgs e)
 if (!Page.IsPostBack)
private void AddTab(string tabName)
 RadTab tab = new RadTab();
 tab.Text = tabName;
 RadPageView pageView = new RadPageView();
 pageView.ID = tabName;

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";

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostBack Then
  End If
End Sub
Private Sub AddTab(ByVal tabName As String)
  Dim tab As New RadTab()
  tab.Text = tabName
  Dim pageView As New RadPageView()
  pageView.ID = tabName
End Sub

Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs)
  Dim userControlName As String = e.PageView.ID + "VB.ascx"
  Dim userControl As Control = Page.LoadControl(userControlName)
  userControl.ID = e.PageView.ID + "_userControl"
End Sub             

See a live example at: Dynamic RadPageView

In this article