<@ trace=true %>
The trace stream has what you want.
Your code below needs to recurse through child controls to be accurate.
for example
void IterateControls(Control parent)
{
foreach (Control child in parent.Controls)
{
if (child.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
&& child.ID.IndexOf("txt_") == 0)
{
TextBox textbox = (TextBox)child;
textbox.Text = "You Got It !";
}
if (child.Controls.Count > 0)
{
IterateControls(child);
}
}
}
On 9/30/05, Arindam <[EMAIL PROTECTED]> wrote:
>
> I need to know howmany controls i have in the page
> I have tried the following options :
> can anyone give an idea ...how the job can be done ???
>
> for (int i=0;i<Page.Controls.Count;i++)
> {
> Response.Write(Page.Controls[i].ClientID.ToString() + "<br>");
> Response.Write(Page.Controls[i].UniqueID.ToString()+ "<br>" );
> }
>
> foreach (Control ctrl in Page.Controls)
> {
> Response.Write(ctrl.ClientID.ToString() + "<br>") ;
> Response.Write(ctrl.GetType().ToString() + "<br>" ) ;
> }
>
>
>
> Arindam Chakraborty
> Software Developer,
> Mumbai,
> India
>
>
>
>
>
> ---------------------------------
> Yahoo! India Matrimony: Find your partner now.
>
> [Non-text portions of this message have been removed]
>
>
>
> ________________________________
> YAHOO! GROUPS LINKS
>
>
> Visit your group "AspNetAnyQuestionIsOk" on the web.
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
> ________________________________
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/