如何在Asp.Net下遍历指定页面上的所有控件
来源:互联网 发布:中国农村淘宝代购点 编辑:程序博客网 时间:2024/05/21 11:07
#region 清空指定页面上所有的控件内容,public static void ClearAllContent( ) ////// 清空指定页面上所有的控件内容,包括TextBox,CheckBox,CheckBoxList,RadioButton,RadioButtonList.但是不清 /// 除如ListBox,DropDownList,因为这样的控件值对当前页面来说还可以用,一般这些控件里都是保存的字典数据. /// Author:Kevin /// 日期:2004-12-02 /// /// 指定的页面 public static void ClearAllContent( System.Web.UI.Control page ) { int nPageControls = page.Controls.Count; for ( int i = 0; i < nPageControls; i++ ) { foreach ( System.Web.UI.Control control in page.Controls[i].Controls ) { if ( control.HasControls( ) ) { ClearAllText( control ); } else { if ( control is TextBox ) ( control as TextBox ).Text = ""; if ( control is CheckBox ) ( control as CheckBox ).Checked = false; if ( control is RadioButtonList ) ( control as RadioButtonList ).SelectedIndex = -1; if ( control is RadioButton ) ( control as RadioButton ).Checked = false; if ( control is CheckBoxList ) { foreach ( ListItem item in ( control as CheckBoxList ).Items ) { item.Selected = false; } } } } } }#endregi
- 如何在Asp.Net下遍历指定页面上的所有控件
- 如何在ASP.NET下遍历指定页面上所有控件[原创]
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 如何在ASP.NET下遍历指定页面上所有控件
- 在Asp.net中如何遍历一个本地目录下的所有文件并上载到Web 服务器上指定的目录中
- asp.net(C#)遍历页面上所有的TextBox控件并给它赋值
- ASP.NET遍历页面的所有button控件
- 如何在asp.net页面上放置的控件上实现左右键菜单,同时
- 如何在asp.net页面上放置的控件上实现左右键菜单,同时
- 遍历页面上的所有控件
- 遍历ASP.Net页面的某个控件
- Asp.Net如何遍历所有TextBox控件并清空
- 如何在asp.net页面上放置的控件上实现左右键菜单,同时对之操作(1)
- Oracle维护常用SQL语句
- JSP 乱码问题
- 遭遇Trojan.PSW.JHOnline,Trojan.Spy.Agent等之后
- 如何在ASP.NET下遍历指定页面上所有控件
- 我的网站的后台管理的结构图。
- 如何在Asp.Net下遍历指定页面上的所有控件
- My Site
- 双选会归来!
- SPL:我发现这个东西IsSaveTOMemery有问题
- 使用设计模式构建通用数据库访问类
- [原创]NickLee.Framework.2.0.1.3
- Java垃圾回收机制浅解
- try
- 中文乱码最终解决方案