void CreateSideBar (TableCell sideBarCell) { RegisterApplyStyle (sideBarCell, SideBarStyle); if (SkipLinkText != "") { System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor (); anchor.HRef = "#" + ClientID + "_SkipLink"; Image img = new Image (); ClientScriptManager csm = new ClientScriptManager (null); img.ImageUrl = csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"); img.Attributes.Add ("height", "0"); img.Attributes.Add ("width", "0"); img.AlternateText = SkipLinkText; anchor.Controls.Add (img); sideBarCell.Controls.Add (anchor); } if (sideBarTemplate != null) { sideBarTemplate.InstantiateIn (sideBarCell); stepDatalist = sideBarCell.FindControl (DataListID) as DataList; if (stepDatalist == null) throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'."); stepDatalist.ItemDataBound += new DataListItemEventHandler(StepDatalistItemDataBound); } else { stepDatalist = new DataList (); stepDatalist.ID = DataListID; stepDatalist.SelectedItemStyle.Font.Bold = true; stepDatalist.ItemTemplate = SideBarItemTemplate; sideBarCell.Controls.Add (stepDatalist); } if (SkipLinkText != "") { System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor (); anchor.ID = "SkipLink"; sideBarCell.Controls.Add (anchor); } stepDatalist.ItemCommand += new DataListCommandEventHandler (StepDatalistItemCommand); stepDatalist.CellSpacing = 0; stepDatalist.DataSource = WizardSteps; stepDatalist.SelectedIndex = ActiveStepIndex; stepDatalist.DataBind (); }
void CreateSideBar (TableCell sideBarCell) { RegisterApplyStyle (sideBarCell, SideBarStyle); if (sideBarTemplate != null) { sideBarTemplate.InstantiateIn (sideBarCell); stepDatalist = sideBarCell.FindControl (DataListID) as DataList; if (stepDatalist == null) throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'."); } else { stepDatalist = new DataList (); stepDatalist.ID = DataListID; sideBarCell.Controls.Add (stepDatalist); } stepDatalist.DataSource = WizardSteps; stepDatalist.ItemTemplate = sideBarItemTemplate; stepDatalist.DataBind (); }
/// <summary> /// Gets the current value of the specified <see cref="TableCell"/> object. /// </summary> /// <param name="cell">The current <see cref="TableCell"/> object.</param> /// <param name="controlId">The nested control's ID property value.</param> /// <param name="controlProperty">The nested control's value property name.</param> /// <returns>The current value.</returns> public Object GetValue(TableCell cell, String controlId, String controlProperty) { Object value = null; if ( String.IsNullOrEmpty(controlId) ) { value = cell.Text; } else { Control control = cell.FindControl(controlId); value = FormUtil.GetValue(control, controlProperty); } return value; }
void AddTemplateCell (TableRow row, ITemplate template, params string[] buttonIds) { TableCell cell = new TableCell (); template.InstantiateIn (cell); foreach (string id in buttonIds) { IButtonControl b = cell.FindControl (id) as IButtonControl; if (b != null) RegisterCommandEvents (b); } row.Cells.Add (cell); }
/// <summary> /// Sets the current value of the specified <see cref="TableCell"/> object. /// </summary> /// <param name="cell">The current <see cref="TableCell"/> object.</param> /// <param name="controlId">The nested control's ID property value.</param> /// <param name="controlProperty">The nested control's value property name.</param> /// <param name="value">The current value.</param> public void SetValue(TableCell cell, String controlId, String controlProperty, Object value) { if ( cell != null ) { if ( String.IsNullOrEmpty(controlId) ) { cell.Text = String.Format("{0}", value); } else { Control control = cell.FindControl(controlId); FormUtil.SetValue(control, controlProperty, value); } } }