日期:2014-05-17 浏览次数:20576 次
protected void Page_Load(object sender, EventArgs e)
{
Reset(this.Page);
}
public void Reset(Control control)
{
foreach (Control ctl in control.Controls)
{
if (ctl is TextBox)
{
TextBox tb = ctl as TextBox;
tb.Text = string.Empty;
}
if (ctl.HasControls())
Reset(ctl);
}
}
------解决方案--------------------
foreach(System.Web.UI.Control ctl in this.Form.Controls){
Response.Write(ctl.ToString()+"<br />");
if (ctl is System.Web.UI.WebControls.TextBox)
{
System.Web.UI.WebControls.TextBox tb = (System.Web.UI.WebControls.TextBox)ctl;
tb.Text = string.Empty;
}
}
------解决方案--------------------