Only the last RadPageView shows content

4 posts, 1 answers
  1. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2009 Link to this post

    I have a RadTabStrip and RadMultipage inside a RadPane like this:

    <telerik:RadTabStrip ID="RadTabStripSearchResults" runat="server"  
             SelectedIndex="0" MultiPageID="RadMultiPage1"
    </telerik:RadTabStrip> 
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="100%" Height="100%"
    </telerik:RadMultiPage> 

    In the code behind I have a search button that will search a database and return a DataTable that I am then passing to this function:

            private void AddSearchPageView(System.Data.DataTable dt) 
            { 
                RadTab resultTab = new RadTab("Search " + Session["searchCount"].ToString() + " (" + dt.Rows.Count.ToString() + ")"); 
                 
                RadPageView pageSearch = new RadPageView(); 
                //resultTab.PageViewID = pageSearch.ID = "pageSearch" + Session["searchCount"].ToString(); 
                 
                RadGrid gridResults = new RadGrid(); 
                System.Data.DataTable dtResults = new System.Data.DataTable(); 
                dtResults = dt; 
                gridResults.ID = "gridResults" + Session["searchCount"].ToString(); 
                gridResults.DataSource = dtResults; 
                gridResults.DataBind(); 
                pageSearch.Controls.Add(gridResults); 
                 
                RadTabStripSearchResults.Tabs.Add(resultTab); 
                 
                RadMultiPage1.PageViews.Add(pageSearch); 
                RadTabStripSearchResults.SelectedIndex = RadMultiPage1.SelectedIndex = RadMultiPage1.PageViews.Count - 1; 
            } 

    The search is working fine, and the AddSearchPageView() seems to be adding one tab for each set of results, and the associated pageview. The problem I am having is that only the last tab is showing the RadGrid.

    1. I would like to create a new tab for each search, and then the user can select the tab to view those search results. 
    2. I would also like to know if there is a way to add a close 'x' to the tab that will remove the tab and associated RadPageView

    Thank you
  2. Answer
    Yana
    Admin
    Yana avatar
    5030 posts

    Posted 30 Dec 2009 Link to this post

    Hi Shane,

    Straight to your questions:

    1. the grids are added dynamically to the pageviews, so their state is not preserves, they should be added on every postback.

    2. please check this online example demonstrating the needed approach.

    Greetings,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2009 Link to this post

    Yana,

    Your link is located on your localhost, I think you meant this link: Delete Button on Tabs

    Thank you for your help, now I just need to figure out how to keep the search results between post backs.
  4. Yana
    Admin
    Yana avatar
    5030 posts

    Posted 05 Jan 2010 Link to this post

    Hello Shane,

    I'm sorry for my confusion - that's exactly the link I meant.

    Best regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top