G
Guest
Hi all,
I have an asp.net 2.0 web app that has an aspx page that has a Master page.
The Master page has the <form runat="server"> defined on it. Now the aspx
page has a UserControl that has a bunch of fields and fieldvalidators.
Inside the code behind of the ascx usercontrol I am trying to loop through
all controls to find all the validators and for some reason I am unable to
find any. Here is the code I am calling on the PreRender event handler of
the usercontrol.
private void InitFieldValidators()
{
int i;
Control c;
for (i = 0; i < this.Controls.Count; i++)
{
c = this.Controls;
SetReqdControl(c);
}
}
private void SetReqdControl(Control o)
{
if (o.HasControls())
{
int i;
Control c;
for (i = 0; i < o.Controls.Count; i++)
{
c = o.Controls;
SetReqdControl(c);
}
}
else
{
Response.Write(o.ID);
Response.Write("<br/>");
}
}
I have an asp.net 2.0 web app that has an aspx page that has a Master page.
The Master page has the <form runat="server"> defined on it. Now the aspx
page has a UserControl that has a bunch of fields and fieldvalidators.
Inside the code behind of the ascx usercontrol I am trying to loop through
all controls to find all the validators and for some reason I am unable to
find any. Here is the code I am calling on the PreRender event handler of
the usercontrol.
private void InitFieldValidators()
{
int i;
Control c;
for (i = 0; i < this.Controls.Count; i++)
{
c = this.Controls;
SetReqdControl(c);
}
}
private void SetReqdControl(Control o)
{
if (o.HasControls())
{
int i;
Control c;
for (i = 0; i < o.Controls.Count; i++)
{
c = o.Controls;
SetReqdControl(c);
}
}
else
{
Response.Write(o.ID);
Response.Write("<br/>");
}
}