Hi Ankit,
System.Web.UI.C ontrol 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.FindContro l("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*****@newsgr oups.nospam>
| References: <un************ *@TK2MSFTNGP12. phx.gbl>
<11************ *********@f14g2 000cwb.googlegr oups.com>
<#N************ **@TK2MSFTNGP10 .phx.gbl>
<11************ **********@g47g 2000cwa.googleg roups.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: dsl-del-dynamic-032.76.246.61.t ouchtelindia.ne t
61.246.76.32
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1320 25
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| thanks
| "Kalpesh" <sh*********@gm ail.com> wrote in message
| news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
| > Thanks Hans for correcting :)
| > I assumed that the label controls are those put by the user explicitly
| >
| > Kalpesh
| >
|
|
|