display a value twice on one page

A

aad

Hi,

I would like to display a label twice on one page.

Duplicate the label result in the error "The ID 'xxxxx' is already
used by another control"
Ok I understand that it can bind to only one control. However I not
able to fix this at the code behind since it is in a dll.

What options do I have to display the value multiple times (javascript?
sessions?)

Can someone please provide me some hints/ solution / example of how to
do this?

Thank You very much,

Aad
 
M

Mark Rae

What options do I have to display the value multiple times (javascript?
sessions?)

Immediately after you've bound the first label...

Label2.Text = Label1.Text;
 
A

aad

Hello Mark.

Thanks for your reply.
How should I implement your suggestion.

The code below doesn't work.
Label1 displays it's value correctly, Label2 shows 'Label2'

-----------------------------------------


<%@ Control Language="c#" AutoEventWireup="false"
Inherits="SPC.ProjectHeader"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<link href="../StyleSheet.css" rel="stylesheet" type="text/css" />

<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
Label2.Text = Label1.Text; }
</script>

<table width="675" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr align="center" valign="middle" class="navlogobar">
<td style="width: 128px"> </td>
<td width="128" class="gridHeader3"><font size="2">
<font size="2"></font></font> <font size="2">
<asp:Label ID="Label1" runat="server">Project</asp:Label>
<asp:Label ID="Label2" runat="server">Label2</asp:Label>

-----------------------------------------
 
M

Mark Rae

Hello Mark.

Thanks for your reply.
How should I implement your suggestion.

The code below doesn't work.
Label1 displays it's value correctly, Label2 shows 'Label2'

Are you sure the Page_Load event is actually firing...?
 
A

aad

Btw. the labels are in an user control (project.ascx) which will be
include in my mainpage (project_main.aspx)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top