public void SetupLoadPartitionTabs(GetTabPanel tabDelegate) { if (ServerPartitionList == null || ServerPartitionList.Count == 0) { NoPartitionPanel.Visible = true; PartitionPanel.Visible = false; return; } NoPartitionPanel.Visible = false; PartitionPanel.Visible = true; int n = 0; this.PartitionTabContainer.Tabs.Clear(); foreach (ServerPartition part in ServerPartitionList) { n++; // create a tab TabPanel tabPanel = new TabPanel(); tabPanel.HeaderText = part.AeTitle; tabPanel.ID = "Tab_" + n; if (tabDelegate != null) { // create a panel for the control UserControl panel = tabDelegate(part); // wrap an updatepanel around the tab UpdatePanel updatePanel = new UpdatePanel(); updatePanel.ContentTemplateContainer.Controls.Add(panel); // put the panel into a lookup table to be used later _mapPanel[part.GetKey()] = updatePanel; // Add the device panel into the tab tabPanel.Controls.Add(updatePanel); } // Add the tab into the tabstrip PartitionTabContainer.Tabs.Add(tabPanel); } if (ServerPartitionList != null && ServerPartitionList.Count > 0) { PartitionTabContainer.ActiveTabIndex = 0; } else { PartitionTabContainer.ActiveTabIndex = -1; } }
public void SetupLoadPartitionTabs(GetTabPanel tabDelegate) { if(ServerPartitionList == null || ServerPartitionList.Count == 0) { NoPartitionPanel.Visible = true; PartitionPanel.Visible = false; return; } NoPartitionPanel.Visible = false; PartitionPanel.Visible = true; int n = 0; this.PartitionTabContainer.Tabs.Clear(); foreach (ServerPartition part in ServerPartitionList) { n++; // create a tab TabPanel tabPanel = new TabPanel(); tabPanel.HeaderText = part.AeTitle; tabPanel.ID = "Tab_" + n; if (tabDelegate != null) { // create a panel for the control UserControl panel = tabDelegate(part); // wrap an updatepanel around the tab UpdatePanel updatePanel = new UpdatePanel(); updatePanel.ContentTemplateContainer.Controls.Add(panel); // put the panel into a lookup table to be used later _mapPanel[part.GetKey()] = updatePanel; // Add the device panel into the tab tabPanel.Controls.Add(updatePanel); } // Add the tab into the tabstrip PartitionTabContainer.Tabs.Add(tabPanel); } if (ServerPartitionList != null && ServerPartitionList.Count > 0) { PartitionTabContainer.ActiveTabIndex = 0; } else { PartitionTabContainer.ActiveTabIndex = -1; } }