how to use foreach loop to edit textboxes

Posted by Ramakrishna on Stack Overflow See other posts from Stack Overflow or by Ramakrishna
Published on 2010-04-28T07:05:24Z Indexed on 2010/04/28 7:13 UTC
Read the original article Hit count: 143

Filed under:

foreach(textbox t in this.controls) { t.text=" "; }

this is what i want to do. to clear all the textboxes in my page, at a time

but it gives an error like

Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.

plz tell me how to do this

© Stack Overflow or respective owner

Related posts about c#