1. 首页
  2. 数据库
  3. 其它
  4. 递归输出ASP.NET页面所有控件的类型和ID的代码

递归输出ASP.NET页面所有控件的类型和ID的代码

上传者: 2021-02-01 15:57:34上传 PDF文件 32.02KB 热度 8次
写一个方法: 代码如下: private void DisplayAllControl(Control control, int step) { foreach (Control ctl in control.Controls) { string s = new string(‘-‘, step * 4) + ctl.GetType().Name + “〈” + ctl.ID + “〉”; Response.Write(s + “”); if (ctl.HasControls()) DisplayAllControl(ctl, step + 1); } } 调用: Display
下载地址
用户评论