Dynamic Multi page controls dissapear

2 posts, 0 answers
  1. Paul
    Paul avatar
    35 posts
    Member since:
    Jul 2008

    Posted 21 Jun 2009 Link to this post

    I am trying to write an application which dynamically adds a tab to a tab strip and a pageview to the multipage and at the same time adds a control to the multi page (my current example uses a button).

    I am sucessfully doing all this apart from I have an issue with my code whic is as follows:

    when i create the tab and add the button it adds fine but when i press the button the control dissapears from the multipage 

    any ideas?

    1  <asp:Button ID="Button3" runat="server" Text="Button" onclick="Button3_Click" /> 
    2          
    3          
    4          
    5         <telerik:RadTabStrip ID="ReportTabs" runat="server" SelectedIndex="0" MultiPageID="ReportMultipage">  
    6             <Tabs> 
    7                 <telerik:RadTab runat="server"  Selected="True" Text="Chart" PageViewID="ReportChartPage">  
    8                 </telerik:RadTab> 
    9                 <telerik:RadTab runat="server" Text="Root RadTab2" PageViewID="RadPageView1">  
    10                 </telerik:RadTab> 
    11             </Tabs> 
    12         </telerik:RadTabStrip> 
    13           
    14         <telerik:RadMultiPage ID="ReportMultipage" runat="server"  OnPageViewCreated ="RadMultiPage1_PageViewCreated" > 
    15               
    16             <telerik:RadPageView ID="ReportChartPage" runat="server" Selected="true" > 
    17                   
    18                 <asp:Button ID="Button1" runat="server" Text="Button" /> 
    19                   </telerik:RadPageView> 
    20                    
    21                   <telerik:RadPageView ID="RadPageView1" runat="server" > 
    22                 <asp:Button ID="Button2" runat="server" Text="Button2" /> 
    23                   </telerik:RadPageView> 
    24                     
    25         </telerik:RadMultiPage> 


    1         protected void Button3_Click(object sender, EventArgs e)  
    2         {  
    3             Guid gu = new Guid();  
    4             gu = System.Guid.NewGuid();  
    5  
    6             RadPageView page = new RadPageView();  
    7             page.ID = "Page" + gu.ToString();  
    8  
    9  
    10             Button but = new Button();  
    11             but.Text = gu.ToString();  
    12             but.ID = "button" + gu.ToString();  
    13             page.Controls.Add(but);  
    14  
    15             ReportMultipage.PageViews.Add(page);  
    16  
    17             RadTab tab = new RadTab();  
    18             tab.Text = gu.ToString();  
    19             tab.PageViewID = "Page" + gu.ToString();  
    20  
    21  
    22             ReportTabs.Tabs.Add(tab);  
    23  
    24             ReportMultipage.SelectedIndex = 0;  
    25  
    26  
    27  
    28  
    29         } 
     
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 22 Jun 2009 Link to this post

    Hello Paul,

    Please take a look at the following examples that shows how to achieve your goal.

    TabStrip / Dynamic RadPageView
    TabStrip / Load on Demand RadPageView

    Greetings,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top