遍历当前页面的控件并只读

来源:互联网 发布:python实用大全 下载 编辑:程序博客网 时间:2024/05/22 17:26
       int nPageControls = Page.Controls.Count;                for (int i = 0; i < nPageControls; i++)                {                    foreach (System.Web.UI.Control control in Page.Controls[i].Controls)                    {                        if (control.HasControls())                        {                        }                        else                        {                            if (control is TextBox)                                (control as TextBox).ReadOnly = true;                        }//if..else                     }//foreach                 }//for 

原创粉丝点击