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

Only the last RadPageView shows content

3 Answers 93 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Shane Grant
Top achievements
Rank 1
Shane Grant asked on 30 Dec 2009, 06:50 AM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 30 Dec 2009, 12:32 PM
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.
0
Shane Grant
Top achievements
Rank 1
answered on 31 Dec 2009, 01:36 AM
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.
0
Yana
Telerik team
answered on 05 Jan 2010, 07:26 AM
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.
Tags
TabStrip
Asked by
Shane Grant
Top achievements
Rank 1
Answers by
Yana
Telerik team
Shane Grant
Top achievements
Rank 1
Share this question
or