Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Referencing a web control more than once on a given page?


Message #1 by "Oliver, Wells" <WOliver@l...> on Wed, 14 Aug 2002 11:32:06 -0700
I have a label control called "labName" and I want it to display three times
on a page.

Putting "<asp:label id="labName" runat="server" />" three times results in
an error ("The ID 'labName' is already used by another control.").

How can this be done? Thanks!

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com

Message #2 by "David Adames" <david@p...> on Wed, 14 Aug 2002 14:38:38 -0400
give each a unique id

if you want them to display same text then...

assign lbl01.text to lbl02.text
assign lbl01.text to lbl03.text

-----Original Message-----
From: Oliver, Wells [mailto:WOliver@l...]
Sent: Wednesday, August 14, 2002 2:32 PM
To: ASP+
Subject: [aspx] Referencing a web control more than once on a given
page?


I have a label control called "labName" and I want it to display three times
on a page.

Putting "<asp:label id="labName" runat="server" />" three times results in
an error ("The ID 'labName' is already used by another control.").

How can this be done? Thanks!

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com


---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450

These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.

---

Message #3 by "Ramanujam" <sramanuj@c...> on Tue, 20 Aug 2002 09:39:33
Hi Oliver...
I have if you want a label to be displayed 3 times and all 3 label should 
have the same ID then Its not possible.... Are you creating the Labels 
Dynamically or during development. 
If you want to do it dynamically then the easy way to do it is change the 
ID dynamically.. somethin similar to this : CODE
<%For i = 1 to 3%>
       <asp:label id="labName"&<%=i%> runat="server"/>
<%Next i%>

Try this... keep me posted if the error still persists....

S.Ramanujam 
Programmer Analyst 
38 & 39 Whites Road, 
WCB - Whites Road Circular Building 
Royapettah, Chennai - 600014 
Ph : +xx xx xxx xxxx Extn 5113 [Off] 
   : +xx xx xxx xxxx           [Res] 
  

==========================================================================
> I have a label control called "labName" and I want it to display three 
times
on a page.

Putting "<asp:label id="labName" runat="server" />" three times results in
an error ("The ID 'labName' is already used by another control.").

How can this be done? Thanks!

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com


  Return to Index