locked
server control inside "Label" control RRS feed

  • Question

  • User1345125660 posted

    hi all,

     

    i was just wondering if it is possible for me to embed a server control inside a label control? to be clear...i have a Label control that is printing <html> codes, now, within that html codes, i want to put <asp:HyperLink ID="hl" runat="server" Text="hyperlink" /> so i could use some server functionalities of this control...is this possible.if yes, how?

     

    many thanks.

    Tuesday, June 24, 2008 12:06 AM

Answers

  • User67562937 posted

    try first to split your html code in two and append your <asp:HyperLink ID="hl" runat="server" Text="hyperlink" /> using StringBuilder...

    e.g.;

    original_code  = your original html code

    Split_1 = first part of your html code (it's up to you)

    Split_2 = second part of your html code (it's up to you)

    first Append = Split_1

    second Append = <asp:HyperLink ID="hl" runat="server" Text="hyperlink" />

    last Append = Split_2

    hope it will give you an idea or i did not misunderstood you... :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 24, 2008 12:26 AM

All replies

  • User-219472588 posted

    Well you can use PlaceHolder instead of Label.

    Tuesday, June 24, 2008 12:19 AM
  • User67562937 posted

    try first to split your html code in two and append your <asp:HyperLink ID="hl" runat="server" Text="hyperlink" /> using StringBuilder...

    e.g.;

    original_code  = your original html code

    Split_1 = first part of your html code (it's up to you)

    Split_2 = second part of your html code (it's up to you)

    first Append = Split_1

    second Append = <asp:HyperLink ID="hl" runat="server" Text="hyperlink" />

    last Append = Split_2

    hope it will give you an idea or i did not misunderstood you... :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 24, 2008 12:26 AM
  • User-1187166364 posted

    in asp.net mostly all the controls are inherited from Control class, And control class has a property that it can add other controls in it and act as a container for other controls..have a look you can use this in this way One more thing about Label, it is just aSpan tag of html , and it can contain any kind of control in it.....

    <asp:Label ID="Label1" runat="server" Text="Label">

    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ="~/Default.aspx" >HyperLink</asp:HyperLink></asp:Label>

     

    Tuesday, June 24, 2008 1:08 AM