Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Lambodar Eng.   on May 27 In Asp.net Category.

  
Question Answered By: Jezza Brown   on May 27

I noticed that it was actually YOU that asked the same question at aspfriends
(all those moons ago)

Even the great Sir Alex Lowe wrote


String myLabelString;
String myTextBoxString;
Control myControl;
foreach (myControl in Page.Controls)
{
switch (myControl.GetType().ToString())
{
case "System.Web.UI.TextBox" :
myTextBoxtring += ((TextBox)myControl).Text;
break;

case "System.Web.UI.Label" :
myLabelString += ((Label)myControl).Text;
break;

default :
'Do stuff with non Label/Textbox controls  if you want
break;
}
}


which will basicaly do what I suggested to do ... my code avoids the need to
know the type, it simply prints the type.

Yet I cannot get any further than Mark ? I cannot get them to show up unless
they have been added programmatically.

So I take it all the code at the link must refer to controls that have been
added programmatically ????? does it ???
how did you fathom what was going on when you asked the original ?

Or have you (or anyone) been able to list controls that were added from the
toolbox ??? (i.e. in the designer).

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Page.Controls Collection Or get search suggestion and latest updates.


Tagged: