public FormElementUserInput(FormElementControl parent, FormElementData data, string answerText, params FormElementDataAnswer[] ansItems)
 {
     this._parent  = parent;
     this._qData   = data;
     this._ansText = answerText;
     this._answers = new FormElementUserInputAnswerCollection(ansItems);
 }
        //***************************************************************************
        // Static Methods
        //
        public static Panel CreateControlContainer(FormElementData data, bool editMode)
        {
            Panel pnl = new Panel();

            pnl.ID          = "pnlElementContainer_" + data.ElementProviderKey.ToString();
            pnl.CssClass    = "dynamicFormElementContainer";
            pnl.Width       = data.ElementWidth;
            pnl.Height      = data.ElementHeight;
            pnl.BorderStyle = data.BorderStyle;
            pnl.BorderColor = data.BorderColor;
            pnl.BorderWidth = data.BorderWidth;
            pnl.BackColor   = data.BackColor;
            pnl.ForeColor   = data.ForeColor;
            if (editMode)
            {
                pnl.Style.Add(HtmlTextWriterStyle.Padding, "4px");
            }
            return(pnl);
        }
        public static FormElementControl GetControl(FormElementData data)
        {
            switch (data.DisplayType)
            {
            case FormElementDisplayType.Grid:
                return(new FormElementGrid(data));

            case FormElementDisplayType.GridCell:
                return(new FormElementGridCell(data));

            case FormElementDisplayType.CheckBoxes:
                return(new FormElementCheckBoxList(data));

            case FormElementDisplayType.DropdownList:
                return(new FormElementDropDownList(data));

            case FormElementDisplayType.HiddenField:
                return(new FormElementHidden(data));

            case FormElementDisplayType.Image:
                return(new FormElementImage(data));

            case FormElementDisplayType.Message:
                return(new FormElementMessage(data));

            case FormElementDisplayType.RadioButtons:
                return(new FormElementRadioButtonList(data));

            case FormElementDisplayType.Textbox:
                return(new FormElementTextbox(data));

            case FormElementDisplayType.Url:
                return(new FormElementLink(data));

            default:
                throw new Exception("Cannot determine dynamic form control. Unrecognized display type: " + data.DisplayType.ToString());
            }
        }
 public static void AddElementStyleAttributes(HtmlTextWriter writer, FormElementData data)
 {
     if (data.MarginLeft != Unit.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, data.MarginLeft.ToString());
     }
     if (data.MarginRight != Unit.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.MarginRight, data.MarginRight.ToString());
     }
     if (data.BorderStyle != BorderStyle.None)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, data.BorderStyle.ToString());
         writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, data.BorderWidth.ToString());
         writer.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, data.BorderColor.GetWebColor());
     }
     if (data.ForeColor != System.Drawing.Color.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Color, data.ForeColor.GetWebColor());
     }
     if (data.BackColor != System.Drawing.Color.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, data.BackColor.GetWebColor());
     }
     if (data.ElementWidth != Unit.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Width, data.ElementWidth.ToString());
     }
     if (data.ElementHeight != Unit.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Height, data.ElementHeight.ToString());
     }
     if (!string.IsNullOrEmpty(data.CssClass))
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Class, data.CssClass);
     }
 }
Beispiel #5
0
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementRadioButtonList(FormElementData data)
     : base(data)
 {
 }
Beispiel #6
0
 //***************************************************************************
 // Class Constructors
 //
 protected FormElementContainerControl(FormElementData data)
     : base(data)
 {
 }
Beispiel #7
0
 //***************************************************************************
 // Class Constructors
 //
 public FormElementDataAnswerCollection(FormElementData parent)
     : base()
 {
     this._owner = parent;
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementGrid(FormElementData data)
     : base(data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementMessage(FormElementData data)
     : base(data)
 {
 }
Beispiel #10
0
 //***************************************************************************
 // Class Constructors
 //
 protected FormElementListControl(FormElementData data)
     : base(data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementCheckBoxList(FormElementData data)
     : base(data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementImage(FormElementData data)
     : base(data)
 {
 }
 protected FormElementControl(FormElementData qData)
     : this()
 {
     this._qData = qData;
     this.ID     = "formElementCtrl_" + this._qData.ElementProviderKey.ToString();
 }
Beispiel #14
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicFormElementEventArgs(FormElementControl element, FormElementData data)
 {
     this.FormElement     = element;
     this.FormElementData = data;
 }
 //***************************************************************************
 // Class Constructors
 //
 protected FormElementControl()
     : base()
 {
     this._qData = new FormElementData();
 }
Beispiel #16
0
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementListbox(FormElementData data)
     : base(data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementHidden(FormElementData data)
     : base(data)
 {
 }
Beispiel #18
0
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementDropDownList(FormElementData data)
     : base(data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 internal FormElementLink(FormElementData data)
     : base(data)
 {
 }
Beispiel #20
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicFormElementRenderingEventArgs(FormElementControl element, FormElementData data)
     : base(element, data)
 {
 }
 //***************************************************************************
 // Class Constructors
 //
 public FormElementUserInput(FormElementControl parent, FormElementData data, string answerText)
     : this(parent, data, answerText, null)
 {
 }