Hello,
Can someone please direct me to sample code where I can find examples of adding Dynamic Tabs, and for each of the Tab I want to a PageView and then Add a RadGrid to the PageView.
I have a Link List on the Page which onclick will create the Tab and content for the tab for each item in the List.
So far I am able to create the Tabs, I call the CreateTabContent Method below when an Item on the List is clicked.
Thanks
Can someone please direct me to sample code where I can find examples of adding Dynamic Tabs, and for each of the Tab I want to a PageView and then Add a RadGrid to the PageView.
I have a Link List on the Page which onclick will create the Tab and content for the tab for each item in the List.
So far I am able to create the Tabs, I call the CreateTabContent Method below when an Item on the List is clicked.
private void CreateTabContent(string Id) |
{ |
bool tabExists = false; |
for (int i = 0; i < RadTabStrip1.Tabs.Count; i++) |
{ |
if (RadTabStrip1.Tabs[i].Text == "Plan Id " + id) |
{ |
tabExists = true; |
RadTabStrip1.SelectedIndex = i; |
break; |
} |
} |
if (tabExists) |
return; |
RadTab tab = new RadTab(); |
RadTabStrip1.Tabs.Add(tab); |
tab.Text = "Tab " + id; |
AddPageView(id); |
} |
private void AddPageView(string pageViewID) |
{ |
RadPageView pageView = new RadPageView(); |
pageView.ID = "pv" + pageViewID; |
pageView.Controls.Add(CreateNewGrid(pageViewID)); |
RadMultiPage1.PageViews.Add(pageView); |
} |
private RadGrid CreateNewGrid(string id) |
{ |
RadGrid RadGrid1 = new RadGrid(); |
RadGrid1.ID = "RadGrid1"; |
SqlDataSource SqlDataSource1 = new SqlDataSource(); |
SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["MyConn"].ToString(); |
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; |
SqlDataSource1.SelectCommand = "MyData"; |
DataSourceSelectArguments args = new DataSourceSelectArguments(); |
SqlDataSource1.SelectParameters.Add("Id", id); |
DataView view = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); |
DataTable table = view.ToTable(); |
RadGrid1.DataSourceID = SqlDataSource1.ID; |
RadGrid1.MasterTableView.DataKeyNames = new string[] { "ID" }; |
RadGrid1.Width = Unit.Percentage(98); |
RadGrid1.PageSize = 5; |
RadGrid1.AllowPaging = false; |
RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; |
RadGrid1.AutoGenerateColumns = true; |
RadGrid1.ShowStatusBar = true; |
RadGrid1.Skin = "Web20"; |
RadGrid1.ShowStatusBar = true; |
//Add Customers table |
RadGrid1.MasterTableView.PageSize = 15; |
RadGrid1.MasterTableView.Width = Unit.Percentage(100); |
return RadGrid1; |
} |
Thanks