现在的位置: 首页 > 综合 > 正文

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

2014年01月13日 ⁄ 综合 ⁄ 共 360字 ⁄ 字号 评论关闭

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

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";
                    }
                }
            }
        }

【上篇】
【下篇】

抱歉!评论已关闭.