/// <summary> /// Add Parent Table to the Page /// </summary> /// <param name="protocolSchemaId"></param> /// <returns></returns> protected void AddParentTableToPage(bool parentIsGrid) { string ControlToLoad; if (parentIsGrid) { ControlToLoad = "AdminSchemaItemChildTableGrid.ascx"; } else { ControlToLoad = "AdminSchemaItemList.ascx"; } parentList = (ProtocolMgmtBaseShemaItemControl)LoadControl(ControlToLoad); Panel pnl = new Panel(); pnl.ID = ParentTable + "Holder"; pnl.Attributes["runat"] = "server"; pnl.Controls.Add(parentList); MainTableContainer.Controls.Add(pnl); bool bDisplayChild = parentList.LoadControl(ParentTable, Request["scitid"], true, CreateFromTemplate); }
/// <summary> /// Add all Child Tables to the Page /// </summary> /// <param name="protocolSchemaId"></param> /// <returns></returns> //protected void AddChildTablesToPage_Garbage(string parentTableName) //{ // string ControlToLoad; // String[] childTables = ChildTables.Split(','); // int maxIndex = childTables.Length - 1; // for (int i = 0; i <= maxIndex; i++) // { // string childName = childTables[i]; // ProtocolMgmtBaseShemaItemControl childGrid; // if (ParentTableLayout == "List and Grid" && i == maxIndex) // ControlToLoad = "AdminSchemaItemChildTableGrid.ascx"; // else // ControlToLoad = "AdminSchemaItemList.ascx"; // childGrid = (ProtocolMgmtBaseShemaItemControl) LoadControl(ControlToLoad); // Panel pnl = new Panel(); // pnl.ID = childName + "Holder"; // pnl.Attributes["runat"] = "server"; // ChildrenTableContainer.Controls.Add(pnl); // pnl.Controls.Add(childGrid); // bool bDisplayChild = childGrid.LoadControl(childName, Request["scitid"], false, CreateFromTemplate); // dictChildTables.Add(childName, childGrid); // } //} private void AddChildTables(IEnumerable <KeyValuePair <string, bool> > childTables) { foreach (KeyValuePair <string, bool> childTable in childTables) { string tablename = childTable.Key; bool isGrid = childTable.Value; string controlName = isGrid ? "AdminSchemaItemChildTableGrid.ascx" : "AdminSchemaItemList.ascx"; ProtocolMgmtBaseShemaItemControl control = (ProtocolMgmtBaseShemaItemControl)LoadControl(controlName); Panel panel = new Panel(); panel.ID = tablename + "Holder"; ChildrenTableContainer.Controls.Add(panel); panel.Controls.Add(control); control.LoadControl(tablename, Request["scitid"], false, CreateFromTemplate); dictChildTables[tablename] = control; } }