想搞一个通用函数,能够将恢复页面的默认状态。
解决方案 »
- GridView导出Excel(问题解答)(寻求源码)
- 关于DataReader
- vs2005 中如何取自定义控件中textbox的值
- 刚刚发布了一个简单的网站,请各位给点意见,顺便就乱码问题向高手求救
- 小问题?
- 在线等!!紧急!紧急!!紧急!!!DataGrid有分页,导出到Excel出错!!!
- Asp.net 网页显示word 文档
- 一个难题:各位高手请进
- 关于存储过程
- 运行vs.net与sqlserver2000时系统报:虚拟内存低!求助解决方法?
- 如何在DataGrid中添加DropDownList控件,并为DropDownList添加数据
- sqlserver中的left,right,top改在oracle上怎么写
或者重定向本页,相当于f5
foreach(Control ctl in Page.Controls[1].Controls)
{
switch(ctl.GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox":
((TextBox)ctl).Text="";
break;
default:
break;
}
}
become tight-coupled, but it'll be the most efficient way. Also, if you
want to make it more flexible, you can use the FindControl method to find
all the enty fields controls thorugh the control ID and reset their text
property, but this will be much less efficient. the best way to do this (assuming you can hard code your form) is to make the reset a standard HTML button: <INPUT TYPE=BUTTON onClick="javascript:clearForm()" NAME="FormToClear"> and then code up some client side script to clear each of the form fields - Pseudo code: function clearForm() {
document.formname.FormToClear.value = ""
... etc
}
{
switch(control .GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox":
((TextBox)control ).Text = "";
break;
case "System.Web.UI.WebControls.DropDownList":
DropDownList ddl = (DropDownList)control ;
ddl.SelectedIndex = -1;
break;
}
}