This is a migrated thread and some comments may be shown as answers.

Dynamically generated Tabstrip and MultiPageView

0 Answers 40 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Viswanathan
Top achievements
Rank 1
Viswanathan asked on 30 Dec 2012, 12:11 AM
Hi,

I have a tabstrip that has a few static tabs and upon a click of a button, a new tab and a new page user controls (from an ascx file) is attached to the tabstrip and multipageview - through the serverside as per the code below: 

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim mTab As New RadTab()
        mTab.Text = "New Release"
        mTab.SelectedCssClass = "Selected"
        mTab.CssClass = "TopTab"
        Me.tabItemTabs.Tabs.Add(mTab)
 
        Dim mPage As New RadPageView
        ' MsgBox("000" & CStr(Val(Trim(Mid(mMultipage.PageViews(mMultipage.PageViews.Count - 1).ID, 1, 2))) + 1))
        mPage.ID = Trim(Right("000" & CStr(Val(Trim(Mid(mMultipage.PageViews(mMultipage.PageViews.Count - 1).ID, 1, 2))) + 1), 2)) + "_mPage_ReleaseForm"
        Me.mMultipage.PageViews.Add(mPage)
        Me.tabItemTabs.Tabs(tabItemTabs.Tabs.Count - 1).Selected = True
        mMultipage.PageViews(mMultipage.PageViews.Count - 1).Selected = True
    End Sub
 
    Private Sub mMultipage_PageViewCreated(sender As Object, e As Telerik.Web.UI.RadMultiPageEventArgs) Handles mMultipage.PageViewCreated
        Select Case Trim(Mid(e.PageView.ID, 10))
            Case "ReleaseForm"
                Dim userControl As Control = Page.LoadControl("releaseform.ascx")
                userControl.ID = e.PageView.ID & "_userControl"
 
                e.PageView.Controls.Add(userControl)
        End Select
    End Sub

The issue is first dynamic tab/page is NOT persistent! meaning, when I click on the static tab and click on the dynamically generated tab, the page is no longer visible; however this is NOT the case with subsequent tabs. What am I missing here? 

Thank you in advance for your advise. 

No answers yet. Maybe you can help?

Tags
TabStrip
Asked by
Viswanathan
Top achievements
Rank 1
Share this question
or