c# help : how to retrive all name of textbox in form

D:\My Documents\inventory\customerlist.aspx.cs(183): 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Name'

it show this ...
 
how to ? more explain please

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:


Line 179: private void btnClear_Click(object sender, System.EventArgs e)
Line 180: {
Line 181: foreach (TextBox t in this.Controls)
Line 182: {
Line 183: Response.Write(t.ID.ToString());
 
all textbox in table and i use table in webform now i use this code
it not go into loop what i'm wrong
Code:
foreach(Control t in this.Controls)
{
   if (t is Table)
   ((Table) t).Visible = false;
}
 
Back
Top