You should try to make a recursive procedure to iterate throu all of your
controls something like this:
private void aa(System.Web.UI.Control ctrl){
foreach(System.Web.UI.Control c in ctrl.Controls){
if(c is TextBox){
((TextBox)c).Text = string.Empty;
}
aa(c);
}
}
then you should call this procedure aa(Page.Controls[0]); when you need to
do this;
Page.Controls give you just the form.
"jw*****@gmail.com" wrote:
I want to iterate through the textboxes on a page and set their text
to an empty string. I do this on pre render. but if i use the
following code i cannot clear the text because a Control object has no
text property. What should i do.
foreach(Control c in Page.Controls)
{
if( c.GetType() == typeof( System.Web.UI.WebControls.TextBox ) )
{
//clear text
}
}