コード例 #1
0
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public BlockCheckBox(bool isChecked, string label = "", bool highlightWhenChecked = false, PostBack postBack = null)
 {
     checkBoxFormValue         = EwfCheckBox.GetFormValue(isChecked, this);
     this.label                = label;
     this.highlightWhenChecked = highlightWhenChecked;
     this.postBack             = postBack;
     NestedControls            = new List <Control>();
 }
コード例 #2
0
        /// <summary>
        /// Creates an in-line radio button that is part of the group.
        /// </summary>
        public EwfCheckBox CreateInlineRadioButton(bool isSelected, string label = "", PostBack postBack = null, bool autoPostBack = false)
        {
            var checkBox = new EwfCheckBox(formValue, label, postBack)
            {
                AutoPostBack = autoPostBack
            };

            checkBoxesAndSelectionStates.Add(Tuple.Create <CommonCheckBox, bool>(checkBox, isSelected));
            return(checkBox);
        }
コード例 #3
0
        void ControlTreeDataLoader.LoadData()
        {
            if (postBack != null || AutoPostBack)
            {
                EwfPage.Instance.AddPostBack(postBack ?? EwfPage.Instance.DataUpdatePostBack);
            }

            PreRender += delegate {
                if (highlightWhenChecked && checkBoxFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues))
                {
                    CssClass = CssClass.ConcatenateWithSpace("checkedChecklistCheckboxDiv");
                }
            };

            var table = TableOps.CreateUnderlyingTable();

            table.CssClass = "ewfBlockCheckBox";

            checkBox   = new WebControl(HtmlTextWriterTag.Input);
            PreRender +=
                delegate {
                EwfCheckBox.AddCheckBoxAttributes(checkBox, this, checkBoxFormValue, radioButtonFormValue, radioButtonListItemId, postBack, AutoPostBack, onClickJsMethods);
            };

            var checkBoxCell = new TableCell().AddControlsReturnThis(checkBox);

            checkBoxCell.Style.Add("width", "13px");

            var row = new TableRow();

            row.Cells.Add(checkBoxCell);

            var labelControl = new HtmlGenericControl("label")
            {
                InnerText = label
            };

            row.Cells.Add(new TableCell().AddControlsReturnThis(labelControl));
            PreRender += (s, e) => labelControl.Attributes.Add("for", checkBox.ClientID);

            table.Rows.Add(row);

            if (NestedControls.Any())
            {
                var nestedControlRow = new TableRow();
                nestedControlRow.Cells.Add(new TableCell());
                nestedControlRow.Cells.Add(new TableCell().AddControlsReturnThis(NestedControls));
                table.Rows.Add(nestedControlRow);

                if (!NestedControlsAlwaysVisible)
                {
                    CheckBoxToControlArrayDisplayLink.AddToPage(this, true, nestedControlRow);
                }
            }

            Controls.Add(table);
            if (ToolTip != null || ToolTipControl != null)
            {
                new ToolTip(ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl(ToolTip), label.Length > 0 ? (Control)labelControl : checkBox);
            }
        }