This example demonstrates how to fetch the contents of RadMultiPage
on demand using Ajax. RadTabStrip is ajaxified and page views are
created on demand in the TabClick event handler:
C#:
private void AddPageView(string pageViewID)
{
RadPageView pageView = new RadPageView();
pageView.ID = pageViewID;
RadMultiPage1.PageViews.Add(pageView);
}
protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab.Text);
e.Tab.PageView.Selected = true;
}
VB.NET
Private Sub AddPageView(ByVal pageViewID As String)
Dim pageView As New RadPageView()
pageView.ID = pageViewID
RadMultiPage1.PageViews.Add(pageView)
End Sub
Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick
AddPageView(e.Tab.Text)
e.Tab.PageView.Selected = True
End Sub
Ajax requests are canceled for tabs whose corresponding pageviews have been loaded.
This is done by setting the postBack client-side property of the
tabs during the OnClientTabSelecting event:
<script type="text/javascript">
function onTabSelecting(sender, args)
{
if (args.get_tab().get_pageViewID())
{
args.get_tab().set_postBack(false);
}
}
</script>