zoukankan      html  css  js  c++  java
  • 呈现控件时出错,未将对象的引用设置到对象的实例(未創建子控件。。。)

    ///
            /// 将此控件呈现给指定的输出参数。
            ///
            /// 要写出到的 HTML 编写器
            protected override void Render(HtmlTextWriter output)
            {

                如果沒有下面一句,則報錯!!!

                EnsureChildControls();
                output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                if (DesignMode)
                {
                    output.AddAttribute(HtmlTextWriterAttribute.Style, "border:0px; border-collapse:collapse;");
                }
                output.RenderBeginTag(HtmlTextWriterTag.Table);

                output.RenderBeginTag(HtmlTextWriterTag.Tr);

                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                _hiddenField.RenderControl(output);
                _textBoxCode.RenderControl(output);
                output.RenderEndTag();

                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                output.AddAttribute(HtmlTextWriterAttribute.Style, "border:solid 1px #AECAF0; border-left:0px; border-right:0px; height:20px; line-height:20px;");
                output.AddAttribute(HtmlTextWriterAttribute.Type,"button");
                output.AddAttribute(HtmlTextWriterAttribute.Value,"選擇");
                output.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(typeof(popupURL)!=\"undefined\"){popupURL.SetContentHTML('');popupURL.SetContentUrl('" + BaseDataUrl + "?t=" + BaseDataType + "&sid=" + FieldName + "&v='+(new Date()).getTime());popupURL.Show();}");
                output.RenderBeginTag(HtmlTextWriterTag.Input);
                output.RenderEndTag();
                output.RenderEndTag();

                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                _textBoxName.RenderControl(output);
                output.RenderEndTag();

                output.RenderEndTag();

                output.RenderEndTag();
            }

  • 相关阅读:
    博客园设置自定义壁纸 模板
    html常用标签及属性,常用英语单词
    解释器安装与环境变量的添加
    计算机基础知识
    python 标准库大全
    进程的状态转换详解
    python 合集set,交集,并集,差集,对称差集别搞混
    vue组件,可以通过npm引用的组件
    use vue vuex vue-router, not use webpack
    Webpack+Vue如何导入Jquery和Jquery的第三方插件
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2029585.html
Copyright © 2011-2022 走看看