I'm trying to implement a tabstrip with multipage. My page views are dynamically loaded user controls.
This is basically how the flow works.
I have a RADgrid (named RadGrid1) that contains a number of columns. When you click on a row in the grid, a tab is created that represents the data of that gridrow. To accompish this I use "RadGrid1_ItemCommand" and check for the "RowClick" command. I then get the name of the column I need and use that to name the tab. Here's the C# code to add the new tab and its coressponding page view.
The problem I'm having is that the first two tabs are created fine, but the thrid tab doesn't get created because I get an error on the page indicating the userControl.ID is a dupicate. Trying to debug this issue I noticed that the code doesn't follow the design I think it should follow.
When I click on a row, I would think the first code execution would be in the "RadGrid1_ItemCommand" method to see if the the "RowClick" command is true, however this is not the case. The first execution appears to be the "RadMultiPage_PageViewCreated" method. If you look at the code above, the "passName" value during the execution the third time has a value from the previous tab creation and therefor the userControl.ID is the same.
Why does execution go directly to "RadMultiPage_PageViewCreated'? Any Thoughts?
Thanks!
This is basically how the flow works.
I have a RADgrid (named RadGrid1) that contains a number of columns. When you click on a row in the grid, a tab is created that represents the data of that gridrow. To accompish this I use "RadGrid1_ItemCommand" and check for the "RowClick" command. I then get the name of the column I need and use that to name the tab. Here's the C# code to add the new tab and its coressponding page view.
private
void AddTab(string tabName)
{
RadTab tab = new RadTab();
tab.Text = tabName;
RadTabStrip.SelectedIndex = selectedTabIndex;
RadTabStrip.Tabs.Add(tab);
RadPageView pageView = new RadPageView();
pageView.ID = tabName;
RadMultiPage.SelectedIndex = selectedTabIndex;
RadMultiPage.PageViews.Add(pageView);
}
protected
void RadMultiPage_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
string userControlName = "UserControls/VMDetails.ascx";
Control userControl = LoadControl(userControlName, passName, passIP);
userControl.ID = passName +
"_vmdtl";
e.PageView.Controls.Add(userControl);
}
The problem I'm having is that the first two tabs are created fine, but the thrid tab doesn't get created because I get an error on the page indicating the userControl.ID is a dupicate. Trying to debug this issue I noticed that the code doesn't follow the design I think it should follow.
When I click on a row, I would think the first code execution would be in the "RadGrid1_ItemCommand" method to see if the the "RowClick" command is true, however this is not the case. The first execution appears to be the "RadMultiPage_PageViewCreated" method. If you look at the code above, the "passName" value during the execution the third time has a value from the previous tab creation and therefor the userControl.ID is the same.
Why does execution go directly to "RadMultiPage_PageViewCreated'? Any Thoughts?
Thanks!