Jump to content
Xtreme .Net Talk

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


Recommended Posts

Posted

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());

 

 

Posted

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;
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...