Beispiel #1
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);
            }
        }
        void ControlTreeDataLoader.LoadData()
        {
            action.AddToPageIfNecessary();

            PreRender += delegate {
                if (setup.HighlightedWhenChecked && 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,
                    action,
                    setup.TriggersPostBackWhenCheckedOrUnchecked,
                    jsClickHandlerStatementLists.SelectMany(i => i()));
            };

            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 (!setup.NestedControlsAlwaysVisible)
                {
                    CheckBoxToControlArrayDisplayLink.AddToPage(this, true, nestedControlRow);
                }
            }

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