protected override void CreateChildControls() { CswAutoTable Table = new CswAutoTable(); this.Controls.Add(Table); HtmlGenericControl ComboDiv = new HtmlGenericControl(); ComboDiv.ID = "cd"; Table.addControl(0, 0, ComboDiv); _Combo = new RadComboBox(); _Combo.AutoPostBack = false; _Combo.AllowCustomText = true; // setting this to false means the box is always empty _Combo.EnableTextSelection = false; _Combo.EnableLoadOnDemand = false; _Combo.Width = Unit.Parse("270px"); _Combo.ID = "combo"; _Combo.EnableEmbeddedSkins = false; _Combo.Skin = "ChemSW"; _TreeView.Height = 300; ComboDiv.Controls.Add(_Combo); _Combo.ItemTemplate = new ComboTreeTemplate(_TreeView); _Combo.Items.Add(new RadComboBoxItem()); //HtmlGenericControl ImageDiv = new HtmlGenericControl("div"); //ImageDiv.Style.Add(HtmlTextWriterStyle.TextAlign, "right"); //_Combo.DropDownFooter.Controls.Add(ImageDiv); //Image DropDownResizeImage = new Image(); //DropDownResizeImage.ID = "comboresize"; //DropDownResizeImage.ImageUrl = "Images/combo/resize.gif"; //ImageDiv.Controls.Add(DropDownResizeImage); //_HiddenNodeValue = new HiddenField(); //_HiddenNodeValue.ID = "value"; //Table.addControl(0, 0, _HiddenNodeValue); //_Validator = new Sample.Web.UI.Compatibility.CustomValidator(); //_Validator.ID = "vld"; //_Validator.ValidateEmptyText = true; //_Validator.ValidationGroup = ValidationGroup; //Table.addControl(0, 0, _Validator); _ClearButton = new CswImageButton(CswImageButton.ButtonType.Clear); _ClearButton.ID = "clear"; Table.addControl(0, 1, _ClearButton); _EditButton = new CswImageButton(CswImageButton.ButtonType.View); _EditButton.ID = "edit"; //_EditButton.Click += new ImageClickEventHandler(_EditButton_Click); _EditButton.Click += new EventHandler(_EditButton_Click); Table.addControl(0, 1, _EditButton); base.CreateChildControls(); }
private void _setupHtmlTable(DataTable Data) { // Header Int32 row = 0; Int32 col = 0; foreach (DataColumn Column in Data.Columns) { GridColumn GC = _Grid.Columns.FindByDataFieldSafe(Column.ColumnName); if (GC != null && GC.Display) { Label HeaderCellValue = new Label(); HeaderCellValue.Text = GC.HeaderText; HeaderCellValue.Style.Add(HtmlTextWriterStyle.FontWeight, "bold"); _Table.addControl(row, col, HeaderCellValue); col++; } } row++; col = 0; // Content foreach (DataRow Row in Data.Rows) { foreach (DataColumn Column in Data.Columns) { GridColumn GC = _Grid.Columns.FindByDataFieldSafe(Column.ColumnName); if (GC != null && GC.Display) { Literal CellValue = new Literal(); CellValue.Text = Row[Column.ColumnName].ToString(); _Table.addControl(row, col, CellValue); col++; } } row++; col = 0; } }
protected override void CreateChildControls() { _Table = new CswAutoTable(); this.Controls.Add(_Table); _NewViewVisibilityDropDown = new DropDownList(); _NewViewVisibilityDropDown.ID = "_NewViewVisibilityDropDown"; _NewViewVisibilityDropDown.CssClass = "selectinput"; _Table.addControl(0, 0, _NewViewVisibilityDropDown); _NewViewVisibilityRoleDropDown = new DropDownList(); _NewViewVisibilityRoleDropDown.ID = "_NewViewVisibilityRoleDropDown"; _NewViewVisibilityRoleDropDown.CssClass = "selectinput"; _Table.addControl(0, 1, _NewViewVisibilityRoleDropDown); _NewViewVisibilityUserDropDown = new DropDownList(); _NewViewVisibilityUserDropDown.ID = "_NewViewVisibilityUserDropDown"; _NewViewVisibilityUserDropDown.CssClass = "selectinput"; _Table.addControl(0, 1, _NewViewVisibilityUserDropDown); base.CreateChildControls(); }
protected override void CreateChildControls() { try { CswAutoTable GridTable = new CswAutoTable(); this.Controls.Add(GridTable); _MainMenu = new CswMainMenu(_CswNbtResources); _MainMenu.ID = "gridmenu"; GridTable.addControl(0, 0, _MainMenu); _GridHeaderIcon = new Image(); GridTable.addControl(1, 0, _GridHeaderIcon); _GridHeaderLiteral = new Literal(); GridTable.addControl(1, 0, _GridHeaderLiteral); _Grid = new RadGrid(); _Grid.ID = "nodesgrid"; _Grid.EnableEmbeddedSkins = false; _Grid.Skin = "ChemSW"; string[] GridDataKeyNames = new string[1]; GridDataKeyNames[0] = "NodeKey"; _Grid.MasterTableView.DataKeyNames = GridDataKeyNames; _Grid.MasterTableView.ClientDataKeyNames = GridDataKeyNames; _Grid.AllowPaging = true; _Grid.ShowFooter = false; _Grid.AllowSorting = true; _Grid.AllowMultiRowEdit = true; _Grid.ClientSettings.Resizing.AllowColumnResize = true; _Grid.ClientSettings.Resizing.EnableRealTimeResize = true; //BZ 10097 -- Waiting on Telerik subscription update //_Grid.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced; _Grid.PageSize = PageSize; //_Grid.PageSizeChanged += new GridPageSizeChangedEventHandler( _Grid_PageSizeChanged ); //_Grid.PageIndexChanged += new GridPageChangedEventHandler( _Grid_PageIndexChanged ); GridTable.addControl(2, 0, _Grid); _NoResultsLiteral = new Literal(); _NoResultsLiteral.Text = "No Results."; GridTable.addControl(2, 0, _NoResultsLiteral); _Table = new CswAutoTable(); _Table.ID = "nodestable"; _Table.CellPadding = 2; _Table.CssClass = "NodesGridTable"; _Table.CellCssClass = "NodesGridTableCell"; GridTable.addControl(2, 0, _Table); } catch (Exception ex) { HandleError(ex); } base.CreateChildControls(); }
} // DataBind() private void _AddQuickLaunchLinkView(CswNbtView View, bool Sticky) { if (View != null) // BZ 8551 #11 { if ((View.ViewId.isSet() && !ViewsInQuickLaunch.ContainsKey(View.ViewId)) || (!View.ViewId.isSet() && View.SessionViewId != null && View.SessionViewId.isSet() && !ViewsInQuickLaunch.ContainsKey(View.SessionViewId))) { _AddQuickLaunchHeader(); //Alphabetical insertion sort - Find where to insert this row Int32 row = _QuickLaunchTable.Rows.Count; for (int r = 1; r < _QuickLaunchTable.Rows.Count; r++) { LinkButton OtherViewLink = _QuickLaunchTable.Rows[r].Cells[0].Controls[1] as LinkButton; if (OtherViewLink.Text.CompareTo(View.ViewName) > 0) { row = r; break; } } _QuickLaunchTable.insertRow(row); Literal BulletLiteral = new Literal(); BulletLiteral.Text = "• "; _QuickLaunchTable.addControl(row, 0, BulletLiteral); LinkButton ViewLink = new LinkButton(); if (View.ViewId.isSet()) { ViewLink.ID = "ViewLink_" + View.ViewId; ViewLink.Click += new EventHandler(ViewLink_Click); ViewsInQuickLaunch.Add(View.ViewId, View); } else { ViewLink.ID = "SessionViewLink_" + View.SessionViewId; ViewLink.Click += new EventHandler(SessionViewLink_Click); ViewsInQuickLaunch.Add(View.SessionViewId, View); } ViewLink.Text = View.ViewName; _QuickLaunchTable.addControl(row, 0, ViewLink); _QuickLaunchTable.addControl(row, 1, new CswLiteralNbsp()); } } }
/// <summary> /// DataBind to Tree /// </summary> protected void CswNodesList_DataBinding(object sender, EventArgs e) { try { EnsureChildControls(); _Table.clear(); bool NoResults = false; if (View == null) { NoResults = true; } else { ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, View, true, false, false); if (Tree == null) { NoResults = true; } else { if (Tree.getChildNodeCount() == 0) { NoResults = true; } else { if (SelectedNodeKey != null) { Tree.makeNodeCurrent(SelectedNodeKey); if (!Tree.isCurrentNodeDefined() || SelectedNodeKey.NodeSpecies == CswEnumNbtNodeSpecies.Root) { SelectedNodeKey = null; } Tree.goToRoot(); } for (Int32 c = 0; c < Tree.getChildNodeCount(); c++) { Tree.goToNthChild(c); CswNbtNodeKey CurrentNodeKey = Tree.getNodeKeyForCurrentPosition(); Int32 ThisRow = _Table.Rows.Count; Image IconImage = new Image(); string IconSuffix = Tree.getNodeForCurrentPosition().IconFileName; string IconName = default(string); if (false == string.IsNullOrEmpty(IconSuffix)) { IconName = "Images/icons/" + IconSuffix; } IconImage.ImageUrl = IconName; _Table.addControl(ThisRow, 0, IconImage); _Table.addControl(ThisRow, 1, new CswLiteralNbsp()); if (EnableLinks) { LinkButton ListLink = new LinkButton(); ListLink.ID = Tree.getNodeKeyForCurrentPosition().ToString(); ListLink.Text = Tree.getNodeNameForCurrentPosition(); ListLink.OnClientClick = "return " + ClientClickFunctionName + "('" + Tree.getNodeKeyForCurrentPosition().ToString() + "');"; _Table.addControl(ThisRow, ListLinkCellNumber, ListLink); _Table.getCell(ThisRow, ListLinkCellNumber).Width = Unit.Parse("100%"); } else { Label ListLabel = new Label(); ListLabel.ID = Tree.getNodeKeyForCurrentPosition().ToString(); ListLabel.Text = Tree.getNodeNameForCurrentPosition(); _Table.addControl(ThisRow, ListLinkCellNumber, ListLabel); _Table.getCell(ThisRow, ListLinkCellNumber).Width = Unit.Parse("100%"); } if ((SelectedNodeKey == null && c == 0) || // first row CurrentNodeKey == SelectedNodeKey) // or selected row { _Table.SelectedRow = ThisRow; } Tree.goToParentNode(); } // for( Int32 c = 0; c < Tree.getChildNodeCount(); c++ ) } // if-else( Tree.getChildNodeCount() == 0 ) } // if-else( Tree == null ) } // if-else( View == null ) if (NoResults) { NoResults = true; Label NoResultsLabel = new Label(); NoResultsLabel.Text = "No results"; _Table.addControl(0, 0, NoResultsLabel); _Table.SelectedRow = 0; } } catch (Exception ex) { HandleError(ex); } }
public void ReinitComponents() { _ComponentPlaceHolder.Controls.Clear(); // BEWARE CswAutoTable ComponentTable = new CswAutoTable(); ComponentTable.ID = "ComponentTable"; ComponentTable.CssClass = "ComponentTable"; //ComponentTable.Style.Add( HtmlTextWriterStyle.TextAlign, TableTextAlign ); ComponentTable.Attributes.Add("align", TableTextAlign); _ComponentPlaceHolder.Controls.Add(ComponentTable); Int32 CellIncrement = 3; foreach (LayoutComponent Component in Components.Values) { TableCell LabelCell = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement); TableCell ValueCell = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement + 1); TableCell ConfigCell = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement + 2); LabelCell.CssClass = CssClassLabelCell; if (EditMode) { ValueCell.CssClass = CssClassValueCellEditMode; } else { ValueCell.CssClass = CssClassValueCell; } if (Component.LabelControl != null) { LabelCell.Controls.Add(Component.LabelControl); } if (Component.ValueControl != null) { ValueCell.Controls.Add(Component.ValueControl); } if (LabelCellRightAlign) { LabelCell.Style.Add(HtmlTextWriterStyle.TextAlign, "right"); } if (EditMode) { CswAutoTable ButtonTable = new CswAutoTable(); ConfigCell.Controls.Add(ButtonTable); if (Component.DisplayRow > 1) { CswImageButton NorthButton = new CswImageButton(CswImageButton.ButtonType.ArrowNorth); NorthButton.ID = "North_" + Component.LayoutComponentId; NorthButton.Click += new EventHandler(MoveButton_Click); ButtonTable.addControl(0, 1, NorthButton); _AjaxManager.AjaxSettings.AddAjaxSetting(NorthButton, ComponentTable); } CswImageButton EastButton = new CswImageButton(CswImageButton.ButtonType.ArrowEast); EastButton.ID = "East_" + Component.LayoutComponentId; EastButton.Click += new EventHandler(MoveButton_Click); ButtonTable.addControl(1, 2, EastButton); _AjaxManager.AjaxSettings.AddAjaxSetting(EastButton, ComponentTable); CswImageButton SouthButton = new CswImageButton(CswImageButton.ButtonType.ArrowSouth); SouthButton.ID = "South_" + Component.LayoutComponentId; SouthButton.Click += new EventHandler(MoveButton_Click); ButtonTable.addControl(2, 1, SouthButton); _AjaxManager.AjaxSettings.AddAjaxSetting(SouthButton, ComponentTable); if (Component.DisplayColumn > 1) { CswImageButton WestButton = new CswImageButton(CswImageButton.ButtonType.ArrowWest); WestButton.ID = "West_" + Component.LayoutComponentId; WestButton.Click += new EventHandler(MoveButton_Click); ButtonTable.addControl(1, 0, WestButton); _AjaxManager.AjaxSettings.AddAjaxSetting(WestButton, ComponentTable); } if (Component.AllowDelete) { CswImageButton DeleteButton = new CswImageButton(CswImageButton.ButtonType.Delete); DeleteButton.ID = "Delete_" + Component.LayoutComponentId; DeleteButton.Click += new EventHandler(DeleteButton_Click); ButtonTable.addControl(1, 1, DeleteButton); _AjaxManager.AjaxSettings.AddAjaxSetting(DeleteButton, ComponentTable); } } // if( EditMode ) } // foreach( LayoutComponent Component in Components.Values ) for (Int32 r = 0; r < ComponentTable.Rows.Count; r++) { for (Int32 c = 0; c < ComponentTable.MaxCells; c++) { TableCell Cell = ComponentTable.getCell(r, c); if (Cell.Controls.Count == 0) { Cell.Controls.Add(new CswLiteralNbsp()); if (c % CellIncrement == 1) // this is a Value Cell { if (EditMode) { Cell.CssClass = CssClassEmptyCellEditMode; } else { Cell.CssClass = CssClassEmptyCell; } } } } // for( Int32 c = 0; c < ComponentTable.MaxCells; c++ ) } // for( Int32 r = 0; r < ComponentTable.Rows.Count; r++ ) } // ReinitComponents()