Hi Ankit,
System.Web.UI.Control only has "ID" property to identify itself, not
"Name". Also, we need to search from the HtmlForm control to loop all the
labels you defined at the top page level( directly under the <form
runat=server>...</from> rather than nested in other container controls).
The following code is just a simple example to loop all the top level
labels:
====================
HtmlForm form1 = Page.FindControl("Form1") as HtmlForm;
foreach(Control ctrl in form1.Controls)
{
if(ctrl is Label)
{
Response.Write("<br>" + ctrl.ID);
}
}
====================
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Ankit Aneja" <ef*****@newsgroups.nospam>
| References: <un*************@TK2MSFTNGP12.phx.gbl>
<11*********************@f14g2000cwb.googlegroups. com>
<#N**************@TK2MSFTNGP10.phx.gbl>
<11**********************@g47g2000cwa.googlegroups .com>
| Subject: Re: variable label control
| Date: Tue, 18 Oct 2005 15:04:54 +0530
| Lines: 10
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <en**************@TK2MSFTNGP15.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: dsl-del-dynamic-032.76.246.61.touchtelindia.net
61.246.76.32
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:132025
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| thanks
| "Kalpesh" <sh*********@gmail.com> wrote in message
| news:11**********************@g47g2000cwa.googlegr oups.com...
| > Thanks Hans for correcting :)
| > I assumed that the label controls are those put by the user explicitly
| >
| > Kalpesh
| >
|
|
|