Hi Das,
First of all if you want to validate the controls in the page you better
use the mechanism present in ASP.NET for that, believe me it's MUCH more
flexible that what you are doing.
Now to iterate in ALL the controls present in a page you start with
Page.Controls , and for each of the controls you find you have to check its
own Controls collection , remember that there are several controls ( Panel,
PlaceHolder, etc) that contains other controls. They are designed using the
composite pattern.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Das" <Da*@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
Hi,
I'm Iterating through all the items in the collection but it only shows
me three objects. on button click I'm passing the method like :
validatePage(this.controls)
the method for Iterating throught the controls is given below:
public static bool validatePage(ControlCollection controls)
{
foreach(Control control in controls )
{
if(control.ToString().Equals("System.Web.UI.WebCon trols.TextBox"))
{
if(((TextBox)control).Text.IndexOf("'")!=-1)
return false;
}
else
if(control.ToString().Equals("System.Web.UI.HtmlCo ntrols.HtmlInputText")) {
if(((HtmlInputText)control).Value.IndexOf("'") != -1)
return false;
}
}
return true;
}
There are more than 30 controls on the form. I'm want to go thourgh each
control within the page. but the controls are within the table does that effect adding controls in
the collection.
thanks,
das
"Tamir Khason" wrote:
this.Controls
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Das" <Da*@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com... Hi All,
Where does asp.net stores the objects declared in the page.
I have a method where I want to loop through all the controls(textbox,
HtmlInputText) within the page. I want to in which collection these (textbox,HtmlInputText) are
stored
thanks in advance..
das