Dear Telerik Team,
I'm new to the RadTabStrip and I'm trying to use it by the on demand approach.
I did follow some of the example in your web site and I'm using UserControl to display deferent content.
How I can load and show the first UserControl for the first time the page appears. Because my current situation is I have to click one tab first in order to load the related UserControl.
Thanks.
Code Behind File:
Dim IsNewPageView As Boolean = False
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.Page.IsPostBack Then
ViewState("sequence") = 0
End If
End Sub
Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs) Handles RadTabStrip1.TabClick
e.Tab.PageViewID = AddPageView(e.Tab.Text)
e.Tab.PageView.Selected = True
End Sub
Private Function AddPageView(ByVal PageViewID As String) As String
Dim PageView As RadPageView = New RadPageView
PageView.ID = PageViewID
IsNewPageView = True
Me.RadMultiPage1.PageViews.Add(PageView)
Me.RadMultiPage1.SelectedIndex = Me.RadMultiPage1.PageViews.Count - 1
Return PageViewID
End Function
Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated
Dim Sequence As Integer = 0
If IsNewPageView Then
Sequence = Convert.ToInt32(ViewState("sequence")) + 1
ViewState("sequence") = Convert.ToString(Sequence)
Else
Sequence = e.PageView.MultiPage.PageViews.Count
End If
Select Case e.PageView.ID.Trim.ToUpper
Case "Permanent".ToUpper
Dim userControlName As String = "Permnent.ascx"
Dim userControl As Control = Page.LoadControl(userControlName)
userControl.ID = e.PageView.ID & "_Permnent"
e.PageView.Controls.Add(userControl)
Case "Standby".ToUpper
Dim userControlName As String = "Standby.ascx"
Dim userControl As Control = Page.LoadControl(userControlName)
userControl.ID = e.PageView.ID & "_Standby"
e.PageView.Controls.Add(userControl)
End Select
End Sub
ASPX File (Java Script:)
<script type="text/javascript">
function onTabSelecting(sender, args)
{
if (args.get_tab().get_pageView())
{
if (args.get_tab().get_pageView().get_id())
{
args.get_tab().set_postBack(false);
}
}
}
</script>