/// <summary> /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns> protected TextBox RenderTextBox(ControlStruct cs) { TextBox textBox = new TextBox(); if (cs != null) { textBox.ID = "txt" + cs.Name; textBox.CssClass = ControlCellStyle.CssClass; textBox.TextMode = TextBoxMode.SingleLine; textBox.Wrap = true; textBox.Enabled = cs.Enabled; textBox.Width = Unit.Percentage(cs.Width); //textBox.Attributes["Width"] = "100%"; } return textBox; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> for Password /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns> protected TextBox RenderPassword(ControlStruct cs) { TextBox box = new TextBox(); if (cs != null) { box.ID = "txt" + cs.Name; box.CssClass = ControlCellStyle.CssClass; box.TextMode = TextBoxMode.Password; box.Wrap = true; box.Enabled = cs.Enabled; box.Width = Unit.Percentage(cs.Width); } return box; }
/// <summary> /// Render the <see cref="RadioButtonList"/> by vertical repeatDirection /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="RadioButtonList"/></returns> protected RadioButtonList RenderRadioVertical(ControlStruct cs) { RadioButtonList list = new RadioButtonList(); if (cs != null) { list.ID = "rbl" + cs.Name; list.CssClass = ControlCellStyle.CssClass; list.Enabled = cs.Enabled; list.RepeatDirection = RepeatDirection.Vertical; list.Width = Unit.Percentage(cs.Width); } return list; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> for Multi line text value /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns> protected TextBox RenderMultiTextBox(ControlStruct cs) { TextBox textBox = new TextBox(); if (cs != null) { textBox.ID = "txt" + cs.Name; textBox.CssClass = ControlCellStyle.CssClass; textBox.TextMode = TextBoxMode.MultiLine; textBox.Wrap = true; textBox.Enabled = cs.Enabled; textBox.Height = Unit.Pixel(cs.Height); textBox.Width = Unit.Percentage(cs.Width); } return textBox; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> for Numeric value /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns> protected TextBox RenderNumericTextBox(ControlStruct cs) { NumericTextBox numericTextBox = new NumericTextBox(); if (cs != null) { numericTextBox.ID = "txt" + cs.Name; numericTextBox.CssClass = ControlCellStyle.CssClass; numericTextBox.TextMode = TextBoxMode.SingleLine; numericTextBox.Wrap = false; numericTextBox.Enabled = cs.Enabled; numericTextBox.Width = Unit.Percentage(cs.Width); } return numericTextBox; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.Calendar"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.Calendar"/></returns> protected static Calendar RenderCalendar(ControlStruct cs) { BusinessCalendar calendar = new BusinessCalendar(); if (cs != null) { calendar.ID = "cal" + cs.Name; //calendar.CssClass = ControlCellStyle.CssClass; calendar.Enabled = cs.Enabled; calendar.Width = Unit.Percentage(cs.Width); } return calendar; }
/// <summary> /// Render the label /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.Label"/></returns> protected Label RenderLabel(ControlStruct cs) { Label label = new Label(); if (cs != null) { label.ID = "lbl" + cs.Name; label.CssClass = ControlCellStyle.CssClass; label.Enabled = cs.Enabled; label.Width = Unit.Percentage(cs.Width); } return label; }
/// <summary> /// Render the <see cref="Adf.Web.UI.DateTextBox"/> for DateTime value /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="Adf.Web.UI.DateTextBox"/></returns> protected DateTextBox RenderDateTimeTextBox(ControlStruct cs) { DateTextBox box = new DateTextBox("dd-MM-yyyy HH:mm"); if (cs != null) { box.ID = "dtb" + cs.Name; box.CssClass = ControlCellStyle.CssClass; box.Enabled = cs.Enabled; box.Width = Unit.Percentage(cs.Width); } return box; }
/// <summary> /// Render the <see cref="DropDownList"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="DropDownList"/></returns> protected DropDownList RenderDropDown(ControlStruct cs) { DropDownList down = new DropDownList(); if (cs != null) { down.ID = "ddl" + cs.Name; down.CssClass = ControlCellStyle.CssClass; down.Enabled = cs.Enabled; down.Width = Unit.Percentage(cs.Width); } return down; }
/// <summary> /// Registers a control as per specified parameter. /// </summary> /// <param name="type"><see cref="ControlType"/>.</param> /// <param name="label">Control display name.</param> /// <param name="name">Control name.</param> /// <param name="height">Control height.</param> /// <param name="width">Control width.</param> /// <param name="enabled">Enable the control.</param> /// <param name="haslabel">Set HasLabel of <see cref="ControlType"/>.</param> protected void Register(ControlType type, string label, string name, int height, int width, bool enabled, bool haslabel) { ControlStruct cs = new ControlStruct(); cs.Type = type; cs.Label = label; cs.Name = name; cs.Height = height; cs.Width = width; cs.Enabled = enabled; cs.HasLabel = haslabel; Lines.Add(cs); }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.CheckBox"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.CheckBox"/></returns> protected CheckBox RenderCheckBox(ControlStruct cs) { CheckBox box = new CheckBox(); if (cs != null) { box.ID = "cbx" + cs.Name; box.CssClass = ControlCellStyle.CssClass; box.Enabled = cs.Enabled; box.Width = Unit.Percentage(cs.Width); } return box; }
/// <summary> /// Creates a label control. /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns>Created label.</returns> protected virtual Control CreateLabel(ControlStruct cs) { Label label = new Label(); if ((cs.Type == ControlType.Blank) || (cs.Type == ControlType.Line)) return label; label.Text = cs.Label; label.CssClass = TitleLabelStyle.CssClass; return label; }
/// <summary> /// Add and create controls /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="ArrayList"/> of controls</returns> protected virtual Control[] CreateControls(ControlStruct cs) { ArrayList controls = new ArrayList(); if (cs.Type == ControlType.Label) controls.Add(RenderLabel(cs)); else if (cs.Type == ControlType.TextBox) controls.Add(RenderTextBox(cs)); else if (cs.Type == ControlType.NumericTextBox) controls.Add(RenderNumericTextBox(cs)); else if (cs.Type == ControlType.SignedIntegerTextbox) controls.Add(RenderSignedIntegerTextBox(cs)); else if (cs.Type == ControlType.UnsignedIntegerTextbox) controls.Add(RenderUnsignedIntegerTextBox(cs)); else if (cs.Type == ControlType.Password) controls.Add(RenderPassword(cs)); else if (cs.Type == ControlType.MultiTextBox) controls.Add(RenderMultiTextBox(cs)); else if (cs.Type == ControlType.Line) controls.Add(RenderLine(cs)); else if (cs.Type == ControlType.Label) controls.Add(RenderLabel(cs)); else if (cs.Type == ControlType.Blank) controls.Add(RenderBlank(cs)); else if (cs.Type == ControlType.Calendar) controls.Add(RenderCalendar(cs)); else if (cs.Type == ControlType.DateTextBox) controls.Add(RenderDateTextBox(cs)); else if (cs.Type == ControlType.DateTimeTextBox) controls.Add(RenderDateTimeTextBox(cs)); else if (cs.Type == ControlType.HyperLink) controls.Add(RenderHyperLink(cs)); else if (cs.Type == ControlType.DropDownList) controls.Add(RenderDropDown(cs)); else if (cs.Type == ControlType.CheckBox) controls.Add(RenderCheckBox(cs)); else if (cs.Type == ControlType.RadioHorizontal) controls.Add(RenderRadioHorizontal(cs)); else if (cs.Type == ControlType.RadioVertical) controls.Add(RenderRadioVertical(cs)); else if (cs.Type == ControlType.Title) controls.Add(RenderTitle(cs)); return controls.ToArray(typeof(Control)) as Control[]; }
/// <summary> /// Render line of <see cref="HtmlTableCell"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="HtmlTableCell"/></returns> protected static HtmlTableCell RenderLine(ControlStruct cs) { HtmlTableCell tc = new HtmlTableCell(); if (cs != null) { tc.ColSpan = 100; tc.InnerHtml = "<HR noshade class=\"line\" width=\"" + cs.Width + "%\">"; } return tc; }
/// <summary> /// Render the title of <see cref="HtmlTableCell"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="HtmlTableCell"/></returns> protected HtmlTableCell RenderTitle(ControlStruct cs) { HtmlTableCell tc = new HtmlTableCell(); if (cs != null) { Label title = new Label(); title.Text = cs.Name; title.CssClass = TitleStyle.CssClass; title.Width = Unit.Percentage(100); tc.Controls.Add(title); tc.ColSpan = 100; } return tc; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.HyperLink"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.HyperLink"/></returns> protected HyperLink RenderHyperLink(ControlStruct cs) { HyperLink hyperLink = new HyperLink(); if (cs != null) { hyperLink.ID = "hl" + cs.Name; hyperLink.CssClass = ControlCellStyle.CssClass; hyperLink.Enabled = cs.Enabled; hyperLink.Width = Unit.Percentage(cs.Width); hyperLink.Target = "new"; } return hyperLink; }
/// <summary> /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> for Unsigned Integer value /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns> protected TextBox RenderUnsignedIntegerTextBox(ControlStruct cs) { UnsignedIntegerTextBox unsignedIntegerTextBox = new UnsignedIntegerTextBox(); if (cs != null) { unsignedIntegerTextBox.ID = "txt" + cs.Name; unsignedIntegerTextBox.CssClass = ControlCellStyle.CssClass; unsignedIntegerTextBox.TextMode = TextBoxMode.SingleLine; unsignedIntegerTextBox.Wrap = false; unsignedIntegerTextBox.Enabled = cs.Enabled; unsignedIntegerTextBox.Width = Unit.Percentage(cs.Width); } return unsignedIntegerTextBox; }
/// <summary> /// Render the blank space of <see cref="HtmlTableCell"/> /// </summary> /// <param name="cs"><see cref="ControlStruct"/></param> /// <returns><see cref="HtmlTableCell"/></returns> protected static HtmlTableCell RenderBlank(ControlStruct cs) { HtmlTableCell tc = new HtmlTableCell(); if (cs != null) { tc.ColSpan = 100; tc.InnerHtml = " "; tc.Attributes.Add("class", "Blank"); } return tc; }