zoukankan      html  css  js  c++  java
  • How to use CreateChildContorls method inherited from System.Web.UI.Control

        *** The CreateChildControls Method ***

        When you create any ASP.Net controls in a web part, you should override the CreateChildControls method. In the CreateChildControls method, you will instantiate each control, set its properties, create any necessary event handlers, and add the created child controls to the web part's Controls collection inherited from System.Web.UI.Control.

        Finally, you can draw the output by overriding the RenderWebPart method.
        The following codes shows a portion of the CreateChildControls method in C#.
       protected Label lbError;
       
    protected Label lbCustomerId;
       
    /// <summary>
       
    ///  CreateChildControls
       
    ///  Override CreateChildControls to add
       
    ///  child ASP.NET controls to this Web Part.
       
    /// </summary>

       protected override void CreateChildControls()
       
    {
          
    //Lable that display error messages
          lbError = new Label();
          lbError.Visible 
    = false;
          lbError.ForeColor 
    = Color.Red;
          Controls.Add(lbError);   
    //Add to controls list
       
          
    //Lable that display Customer Id
          lbCustomerId =  new Label();
          lbCustomerId.Visible 
    = false;
          Controls.Add(lbCustomerId);   
    //Add to controls list
       }
  • 相关阅读:
    微信登录
    Nginx负载均衡的优缺点
    elk 比较不错的博客
    Filebeat 5.x 日志收集器 安装和配置
    日志管理系统ELK6.2.3
    python3爬虫编码问题
    zabbix监控进程
    linux下查询进程占用的内存方法总结
    Ubuntu 16.04安装Elasticsearch,Logstash和Kibana(ELK)Filebeat
    ELK多种架构及优劣
  • 原文地址:https://www.cnblogs.com/rickie/p/25727.html
Copyright © 2011-2022 走看看