Hyperlink inside label WebControl

Discussion in 'ASP .Net' started by Christian Hofmann, Mar 4, 2006.

  1. 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
    Christian Hofmann, Mar 4, 2006
    #1
    1. Advertising

  2. 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

    "Christian Hofmann" wrote:

    > 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
    >
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Mar 4, 2006
    #2
    1. Advertising

  3. Hello Elton,

    "Elton W" <> schrieb im Newsbeitrag
    news:...
    > 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
    Christian Hofmann, Mar 4, 2006
    #3
  4. 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

    "Christian Hofmann" wrote:

    > Hello Elton,
    >
    > "Elton W" <> schrieb im Newsbeitrag
    > news:...
    > > 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
    >
    >
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Mar 4, 2006
    #4
  5. Hello Elton,

    "Elton W" <> schrieb im Newsbeitrag
    news:...
    > 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
    Christian Hofmann, Mar 5, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    0
    Views:
    780
  2. Guest
    Replies:
    2
    Views:
    723
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    174
    Kasabaarde Sumta
    Dec 13, 2004
  4. Dave
    Replies:
    0
    Views:
    419
  5. Knut Krueger
    Replies:
    8
    Views:
    246
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page