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);
  • 相关阅读:
    341. Flatten Nested List Iterator
    667. Beautiful Arrangement II
    953. Verifying an Alien Dictionary
    1704. Determine if String Halves Are Alike
    MySQL数据库的数据类型详解【转】
    Dart之数组(List)的相关方法总结【转】
    Flutter解决点击非输入框时关闭键盘问题及TextFormField焦点切换问题【转】
    Flutter Switch开关【转】
    Image Picker
    Flutter按钮添加背景图片及文字【转】
  • 原文地址:https://www.cnblogs.com/88223100/p/1230093.html
Copyright © 2011-2022 走看看