// construction and disposing public BocReferenceValue() { _listItems = new ListItemCollection(); _dropDownListStyle = new DropDownListStyle(); }
protected void Page_Load(object sender, System.EventArgs e) { if (Page.IsPostBack == false) { DrawColors(); // Add data to the borderColorList, // backColorList, and foreColorList controls. //ListItemCollection colors = new ListItemCollection(); //colors.Add( Color.Black.Name ); //colors.Add( Color.Blue.Name ); //colors.Add( Color.Green.Name ); //colors.Add( Color.Orange.Name ); //colors.Add( Color.Purple.Name ); //colors.Add( Color.Red.Name ); //colors.Add( Color.White.Name ); //colors.Add( Color.Yellow.Name ); Colors colors = new Colors(); DropDownListBorderColor.DataSource = colors; DropDownListBorderColor.DataBind(); DropDownListBackColor.DataSource = colors; DropDownListBackColor.DataBind(); DropDownListForegroundColor.DataSource = colors; DropDownListForegroundColor.DataBind(); // Add data to the borderStyleList control. ListItemCollection styles = new ListItemCollection(); Type styleType = typeof(BorderStyle); foreach (string s in Enum.GetNames(styleType)) { styles.Add(s); } borderStyleList.DataSource = styles; borderStyleList.DataBind(); // Add data to the borderWidthList control. ListItemCollection widths = new ListItemCollection(); for (int i = 0; i < 46; i++) { widths.Add(i.ToString() + "px"); } borderWidthList.DataSource = widths; borderWidthList.DataBind(); // Add data to the fontNameList control. ListItemCollection names = new ListItemCollection(); names.Add("Arial"); names.Add("Courier"); names.Add("Garamond"); names.Add("Time New Roman"); names.Add("Verdana"); fontNameList.DataSource = names; fontNameList.DataBind(); // Add data to the fontSizeList control. ListItemCollection fontSizes = new ListItemCollection(); fontSizes.Add("Small"); fontSizes.Add("Medium"); fontSizes.Add("Large"); fontSizes.Add("10pt"); fontSizes.Add("14pt"); fontSizes.Add("20pt"); fontSizeList.DataSource = fontSizes; fontSizeList.DataBind(); // Font Style ListItemCollection stylesF = new ListItemCollection(); Type styleTypeF = typeof(FontStyle); foreach (string s in Enum.GetNames(styleTypeF)) { stylesF.Add(s); } DropDownListStyle.DataSource = stylesF; DropDownListStyle.DataBind(); CheckBoxListFontStyle.DataSource = stylesF; CheckBoxListFontStyle.DataBind(); // Set primaryStyle as the style for each control. applyStyle(); } string pageIsCallBack = ""; if (Page.IsCallback) { pageIsCallBack = "Page.IsCallback == true"; } else { pageIsCallBack = "Page.IsCallback == false"; } string pageIsPostBack = ""; if (Page.IsPostBack) { pageIsPostBack = "Page.IsPostBack == true"; } else { pageIsPostBack = "Page.IsPostBack == false"; } Trace.Warn("Page_Load : " + pageIsCallBack); Trace.Warn("Page_Load : " + pageIsPostBack); }