日期:2014-05-17  浏览次数:20461 次

疑难算法问题,遍历全部控件

 public void SetReadOnly()
        {
            foreach (Control c in this.Page.Controls)
            {
                foreach (Control cc in c.Controls)
                {
                    if (cc is HtmlTableRow)
                    {
                        foreach (Control ccc in cc.Controls)
                        {
                            if (cc is TextBox)
                            {
                                if ((cc as TextBox).ReadOnly == true)
                                {
                                    (cc as TextBox).ReadOnly = false;
                                    (cc as TextBox).Attributes.Add("readonly", "readonly");
                                }
                            }
                        }