dynamically add tabstrip and multipage

2 posts, 0 answers
  1. Duy
    Duy avatar
    5 posts
    Member since:
    May 2016

    Posted 22 Jun 2016 Link to this post

    hi all, please help me. i have code below and it adds tab and pageview fine. but after 2 tab it will not add anymore and keep complaining that i'm trying to add control with same ID. i know i'm not adding the same ID. So please help me resolve this issue. thank you so much for your time

    <script type="text/javascript">
            function OnClientTabSelecting(sender, eventArgs) {
                var tab = eventArgs.get_tab();
                if (tab.get_text() == "")
                    document.getElementById("div_AddTab").style.display = "block";
    <div id="div_AddTab" style="display:none;">
            Tab Title: <telerik:RadTextBox ID="txt_TabTitle" runat="server" />
            Element Type: <telerik:RadComboBox ID="ddl_ElementType" runat="server" />
            <telerik:RadButton ID="btn_AddTab" runat="server" Text="Add Tab" />
            <telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1"  Orientation="HorizontalTop" Width="760"
                 MultiPageID="RadMultiPage1" Skin="Windows7" OnClientTabSelecting="OnClientTabSelecting">
                    <telerik:RadTab runat="server" Text="tab1" />
                    <telerik:RadTab runat="server" Text="tab2" />
                    <telerik:RadTab runat="server" Text="" ImageUrl="~/images/add.png" />
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="760" Height="380" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated">
                <telerik:RadPageView ID="RadPageView1" runat="server">
                <telerik:RadPageView ID="RadPageView2" runat="server">
                    test 2

    Protected Sub btn_AddTab_Click(sender As Object, e As EventArgs) Handles btn_AddTab.Click       
            AddPageView(Trim(txt_TabTitle.Text), ddl_ElementType.SelectedItem.Text)
        End Sub
        Protected Sub RadMultiPage1_PageViewCreated(sender As Object, e As RadMultiPageEventArgs)
            Dim rad_Editor As RadEditor = New RadEditor
            Dim radSlider As New RadSlider
            Select Case ddl_ElementType.SelectedValue
                Case "T"
                    rad_Editor.ID = "radEditor_" & Trim(txt_TabTitle.Text)
                Case "B"
                Case "N"
            End Select
        End Sub
        Private Sub AddTab(title As String)
            Dim tabTemplate = New TabTemplate()
            Dim tab As New RadTab() With { _
                .Text = title,
                .PageViewID = "pv" & title _
            RadTabStrip1.Tabs.Insert((RadTabStrip1.Tabs.Count - 1), tab)
            RadTabStrip1.SelectedIndex = tab.Index
        End Sub
        Private Sub AddPageView(pvId As String, elementType As String)
            Dim pageView As RadPageView = New RadPageView()
            pageView.ID = "pv_" & pvId
            pageView.CssClass = "pageView"
            RadMultiPage1.SelectedIndex = pageView.Index
        End Sub
  2. Duy
    Duy avatar
    5 posts
    Member since:
    May 2016

    Posted 23 Jun 2016 Link to this post

    incase anyone rnning into the same issue

    replace rad_Editor.ID = "radEditor_" & Trim(txt_TabTitle.Text) with rad_Editor.ID = "radEditor_" & e.PageView.ID

Back to Top