Hyperlink inside label WebControl

  • Thread starter Christian Hofmann
  • Start date
C

Christian Hofmann

Hello,

How is it possible to use a hyperlink webcontrol inside a label webcontrol?

I am using resources for globalisation. Now I have a text like this:

Please click here to open that document.

"here" would be linked and should be a hyperlink webcontrol. But that is not
possible.
The other way would be to make "Please click" and "to open that document" to
labels and here to a hyperlink webcontrol.

But in other languages it would sounds crazy when translating exactly both
labels in the resource-files. So I need to integrate a hyperlink webcontrol
in a label webcontrol.

How can I solve this problem?

Thank you,

Christian
 
G

Guest

Hi Christian,

You can put a Label like

<asp:Label id="lblID" runat="server">Please click <a href='url'
target='_blank'>here</a> to open file</asp:Label>

HTH

Elton Wang
 
C

Christian Hofmann

Hello Elton,

Elton W said:
Hi Christian,

You can put a Label like

<asp:Label id="lblID" runat="server">Please click <a href='url'
target='_blank'>here</a> to open file</asp:Label>

But I am using localization:
<asp:Label id="lblID" runat="server"
meta:resourcekey="MyResourceKey></asp:Label>

so this is not possible. Do you have an other idea?

Thank you,

Christian
 
G

Guest

Suppose in Resource you get test for the label is like

"Please click here to open file"

How about to try in lblID_PreRender event

lblID.Text = lblID.Text.Replace("here", "<a href='url'>here</a>");

Elton
 
C

Christian Hofmann

Hello Elton,

Elton W said:
Suppose in Resource you get test for the label is like

lblID.Text = lblID.Text.Replace("here", "<a href='url'>here</a>");

This is a good solution for non ressource based projects. But the designers
should choose the links and names themselves.

Maybe it is possible to inherit the label webcontrol and the hyperlink
webcontrol. To combine them into one webcontrol. But I have no figure how to
do that.

Christian
 

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,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top