遍历页面控件 并初始化控件值

来源:互联网 发布:通达信编程 编辑:程序博客网 时间:2024/05/01 22:53

遍历页面控件 并初始化控件值

private void InitLabel()
        {
            for (int i = 0; i < Page.Controls.Count; i++)
            {
                foreach (System.Web.UI.Control control in Page.Controls[i].Controls)
                {
                    if (control is Label)
                    {
                        (control as Label).Text = "0";
                    }
                }
            }
        }

0 0