遍历母板下所有控件,递归方式
private void GetControls(Control c)
{
if (c is Label)
Response.Write(c.ID + "<br />");
if (c.HasControls())
foreach (Control con in c.Controls)
GetControls(con);
}
如果知道父控件,获取控件所要的开销会小很多
黑色头发:http://heisetoufa.iteye.com/
遍历母板下所有控件,递归方式
private void GetControls(Control c)
{
if (c is Label)
Response.Write(c.ID + "<br />");
if (c.HasControls())
foreach (Control con in c.Controls)
GetControls(con);
}
如果知道父控件,获取控件所要的开销会小很多
黑色头发:http://heisetoufa.iteye.com/
一、 Asp.Net Page页面中访问所有控件的属性为: Page.Controls 控件的结构是树结构。 二、获取指定类型所有控件实例: 1.递归方法定义: 2.使用调用:
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M