Moderators Robby Posted November 18, 2003 Moderators Posted November 18, 2003 foreach (TextBox t in this.Controls) { MessageBox.Show( t.Name.ToString()); } Quote Visit...Bassic Software
wondery Posted November 18, 2003 Author Posted November 18, 2003 D:\My Documents\inventory\customerlist.aspx.cs(183): 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Name' it show this ... Quote
*Experts* Volte Posted November 18, 2003 *Experts* Posted November 18, 2003 Change Name to ID if you are using ASP.NET. Quote
wondery Posted November 18, 2003 Author Posted November 18, 2003 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()); Quote
wondery Posted November 18, 2003 Author Posted November 18, 2003 all textbox in table and i use table in webform now i use this code it not go into loop what i'm wrong foreach(Control t in this.Controls) { if (t is Table) ((Table) t).Visible = false; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.