示例#1
0
        /// <summary>
        /// Render do controlo
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            base.CssClass = "OWCheckBoxList";
            RepeatInfo info1  = new RepeatInfo();
            Style      style1 = base.ControlStyleCreated ? base.ControlStyle : null;
            short      num1   = this.TabIndex;
            bool       flag1  = false;

            this.controlToRepeat.TabIndex = num1;
            if (num1 != 0)
            {
                if (!this.ViewState.IsItemDirty("TabIndex"))
                {
                    flag1 = true;
                }
                this.TabIndex = 0;
            }
            info1.RepeatColumns   = this.RepeatColumns;
            info1.RepeatDirection = this.RepeatDirection;
            info1.RepeatLayout    = this.RepeatLayout;
            info1.RenderRepeater(writer, this, style1, this);
            if (num1 != 0)
            {
                this.TabIndex = num1;
            }
            if (flag1)
            {
                this.ViewState.SetItemDirty("TabIndex", false);
            }
        }
示例#2
0
        /// <summary>
        /// 将控件呈现给指定的 HTML 编写器。
        /// </summary>
        /// <param name="writer">接收控件内容的 <see cref="HtmlTextWriter"/> 对象。</param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (!this.IsShowUnchecked)
            {
                DeleteUnChecked();
            }

            if (this.Items.Count <= 0)
            {
                return;
            }

            RepeatInfo info = new RepeatInfo();

            info.RepeatColumns   = this.RepeatColumns;
            info.RepeatDirection = this.RepeatDirection;
            if (!base.DesignMode && !this.Context.Request.Browser.Tables)
            {
                info.RepeatLayout = RepeatLayout.Flow;
            }
            else
            {
                info.RepeatLayout = this.RepeatLayout;
            }
            Style controlStyle = base.ControlStyleCreated ? base.ControlStyle : null;

            info.RenderRepeater(writer, this, controlStyle, this);
        }
示例#3
0
        string DoTest(int cols, int cnt, RepeatDirection d, RepeatLayout l, bool OuterTableImplied, bool ftr, bool hdr, bool sep)
        {
            HtmlTextWriter htw = GetWriter();
            RepeatInfo     ri  = new RepeatInfo();

            ri.RepeatColumns     = cols;
            ri.RepeatDirection   = d;
            ri.RepeatLayout      = l;
            ri.OuterTableImplied = OuterTableImplied;

            ri.RenderRepeater(htw, new RepeatInfoUser(ftr, hdr, sep, cnt), new TableStyle(), new DataList());
            return(htw.InnerWriter.ToString());
        }
示例#4
0
        private void RenderRepeater_BaseControl(string s, string msg, WebControl wc)
        {
            RepeatInfo ri = new RepeatInfo();

            ri.RepeatColumns   = 3;
            ri.RepeatDirection = RepeatDirection.Vertical;
            ri.RepeatLayout    = RepeatLayout.Table;

            HtmlTextWriter writer = GetWriter();

            ri.RenderRepeater(writer, new RepeatInfoUser(false, false, false, 1), new TableStyle(), wc);
            Assert.AreEqual(s, writer.InnerWriter.ToString(), msg);
        }
示例#5
0
		public static string DoTest (int cols, int cnt, RepeatDirection d, RepeatLayout l, bool OuterTableImplied, bool hdr, bool ftr, bool sep)
		{
			HtmlTextWriter htw = GetWriter ();
			RepeatInfo ri = new RepeatInfo ();
			ri.RepeatColumns = cols;
			ri.RepeatDirection = d;
			ri.RepeatLayout = l;
			ri.OuterTableImplied = OuterTableImplied;
			// get some variation in if we use style or not
			Style s = new Style ();
			if (cols != 3)
				s.CssClass = "mainstyle";
			
			ri.RenderRepeater (htw, new RepeatInfoUser (hdr, ftr, sep, cnt), s, new DataList ());
			return htw.InnerWriter.ToString ();
		}
示例#6
0
        public static string DoTest(int cols, int cnt, RepeatDirection d, RepeatLayout l, bool OuterTableImplied, bool hdr, bool ftr, bool sep)
        {
            HtmlTextWriter htw = GetWriter();
            RepeatInfo     ri  = new RepeatInfo();

            ri.RepeatColumns     = cols;
            ri.RepeatDirection   = d;
            ri.RepeatLayout      = l;
            ri.OuterTableImplied = OuterTableImplied;
            // get some variation in if we use style or not
            Style s = new Style();

            if (cols != 3)
            {
                s.CssClass = "mainstyle";
            }

            ri.RenderRepeater(htw, new RepeatInfoUser(hdr, ftr, sep, cnt), s, new DataList());
            return(htw.InnerWriter.ToString());
        }
示例#7
0
        protected override void Render(HtmlTextWriter writer)
        {
            var repeatInfo = new RepeatInfo();

            if (!this.ControlStyleCreated)
            {
                var tabIndex = this.TabIndex;
                var flag     = false;

                if (Convert.ToBoolean(tabIndex))
                {
                    if (!this.ViewState.IsItemDirty("TabIndex"))
                    {
                        flag = true;
                    }
                    this.TabIndex = 0;
                }
                repeatInfo.RepeatLayout = RepeatLayout.Flow;

                // Create dummy htmlTextWriter because repeatInfo generates an unwanted span-tag
                // So we generate the items in the global private htmlTextWriter.
                using (var sw = new StringWriter(CultureInfo.InvariantCulture)) {
                    using (var repWriter = new HtmlTextWriter(sw)) {
                        repeatInfo.RenderRepeater(repWriter, this, null, this);
                    }
                }

                writer.Write(this.StringWriter);                 // Copy the private htmlTextWriter into the current htmlTextWriter.

                if (Convert.ToBoolean(tabIndex))
                {
                    this.TabIndex = tabIndex;
                }
                if (Convert.ToBoolean(flag))
                {
                    this.ViewState.SetItemDirty("TabIndex", false);
                }
            }
        }
示例#8
0
        /// <exclude />
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.controlToRepeat == null)
            {
                this.CreateControlToRepeat();
            }

            if (this.Font.Size == FontUnit.Empty)
            {
                this.Font.Size = FontUnit.Parse("1em", System.Globalization.CultureInfo.InvariantCulture);
            }

            Boolean setTabIndexDirty = false;

            this.controlToRepeatTabIndex = this.TabIndex;

            if (controlToRepeatTabIndex != 0)
            {
                if (!base.ViewState.IsItemDirty("TabIndex"))
                {
                    setTabIndexDirty = true;
                }
                base.TabIndex = 0;
            }

            if (this.SelectionMode == VoteSelectionMode.Rating)
            {
                DropDownList rateControl = (DropDownList)this.controlToRepeat;
                Int32        rateCount   = this.Items.Count;
                if (!this.AllowWriteInVote)
                {
                    rateCount--;
                }
                for (Int32 i = 1; i <= rateCount; i++)
                {
                    rateControl.Items.Add((i).ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
            }

            if (!this.AllowWriteInVote && this.Items.Count > 0)
            {
                this.Items.RemoveAt(this.Items.Count - 1);
            }

            RepeatInfo repeatInfo        = new RepeatInfo();
            Style      inputControlStyle = (this.ControlStyleCreated) ? this.ControlStyle : null;

            repeatInfo.RepeatColumns   = this.RepeatColumns;
            repeatInfo.RepeatDirection = this.RepeatDirection;
            repeatInfo.RepeatLayout    = this.RepeatLayout;
            repeatInfo.RenderRepeater(writer, this, inputControlStyle, this);

            if (this.controlToRepeatTabIndex != 0)
            {
                base.TabIndex = this.controlToRepeatTabIndex;
            }
            if (setTabIndexDirty)
            {
                base.ViewState.SetItemDirty("TabIndex", false);
            }
            this.controlToRepeat = null;
        }