コード例 #1
0
        /// <summary>
        /// 判断是否只是输出本控件,如果是则进行只输出本控件处理,否则进行正常的控件输出
        /// </summary>
        /// <param name="writer">接收控件内容的 HtmlTextWriter 对象。</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (this.RenderMode.OnlyRenderSelf && !this.RenderMode.UseNewPage)
            {
                StringBuilder strB = new StringBuilder();
                StringWriter  sw   = new StringWriter(strB);
                using (HtmlTextWriter baseWriter = new HtmlTextWriter(sw))
                {
                    base.RenderControl(baseWriter);
                }

                WebControlUtility.RenderControlOnlySelf(this, strB.ToString(), this.RenderMode);
            }
            else
            {
                base.RenderControl(writer);
            }
        }