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();
            }

  • 相关阅读:
    [Effective Java读书笔记] 第二章 创建和销毁对象(1~7)
    [Guava官方文档翻译] 5. Guava的Object公共方法 (Common Object Utilities Explained)
    [Guava官方文档翻译] 4. 使用Guava Ordering排序 (Ordering Explained)
    iOS正则表达式
    ios UIKit动力
    iOS8 UISearchViewController搜索功能讲解
    APP被苹果APPStore拒绝的各种原因
    iOS tableViewCell plane格式下,接近section边缘不显示分割线却被复用解决办法
    企业证书APP发布流程
    iOS越狱包
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2029585.html
Copyright © 2011-2022 走看看