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
       }
  • 相关阅读:
    CentOS7安装docker
    CentOS7安装maven
    centos下使用ifconfig命令无法得到ip地址的解决方案
    Elasticsearch 2.3.5 之Head插件安装
    CentOS7中yum源结构解析
    EXT.NET Combox下拉Grid
    转 Refresh Excel Pivot Tables Automatically Using SSIS Script Task
    SQL Server Integration Services SSIS最佳实践
    PowerBI
    [XAF] Llamachant Framework Modules
  • 原文地址:https://www.cnblogs.com/rickie/p/25727.html
Copyright © 2011-2022 走看看