zoukankan      html  css  js  c++  java
  • 设置页面所有控件

    private void InItControl( ControlCollection connection)
        {
            foreach (System.Web.UI.Control ctrl in connection)
            {
                if (ctrl.HasControls())
                {
                    InItControl(ctrl.Controls);
                }
                else
                {
                    if (ctrl is System.Web.UI.WebControls.TextBox)
                    {
                        ((TextBox)ctrl).ReadOnly = true;
                    }
                    if (ctrl is System.Web.UI.WebControls.DropDownList)
                    {
                        ((DropDownList)ctrl).Enabled = false;
                    }
                    if (ctrl is System.Web.UI.WebControls.RadioButtonList)
                    {
                        ((RadioButtonList)ctrl).Enabled = false;
                    }
                    if (ctrl is System.Web.UI.WebControls.CheckBox)
                    {
                        ((CheckBox)ctrl).Enabled = false;
                    }
                    if (ctrl is System.Web.UI.WebControls.Button)
                    {
                        ((Button)ctrl).Enabled = false;
                    }
                    if (ctrl is System.Web.UI.WebControls.LinkButton)
                    {
                        ((LinkButton)ctrl).Enabled = false;
                    }
                }
            }
        }






    在我的页面上目前只有这些控件   有其他需要设置的   按照方法向上加就是
    在调用的时候写InItControl(Page.Controls);
  • 相关阅读:
    oracle,mysql对敏感,关键字等处理
    eclipse内置tomcat启动方法
    plsql登录弹白框
    date
    linux乱码
    环境变量
    终端类型
    netstat -aon|findstr 8888 终止进程
    export
    bash环境变量读取顺序
  • 原文地址:https://www.cnblogs.com/88223100/p/1230093.html
Copyright © 2011-2022 走看看