locked
Issues with asp:LinkButton RRS feed

  • Question

  • User-1924877455 posted
    Hello I have to display a Link consisting of text and an image. For that purpose, I have created a Linkbutton control and placed an Image control inside it. I want to know, if its a correct method, since I am facing some issues with it. I have two such Linkbuttons placed side by side, however upon postback one of them becomes invisible, basically its HTML is not rendered correctly after postback. Is it because a LinkButton control cannot act as a container for other control ?
    Thursday, August 28, 2008 6:16 PM

Answers

  • User481221548 posted

    Hi Madhur

    If you want to use serverside Events based on Postbacks, use ImageButton or LinkButton.
    If not, use a HyperLink with filled ImageUrl property.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 31, 2008 11:07 PM

All replies

  • User-16411453 posted

     I think with the linkbutton control, the space in between the tag is for text.

    I use a ImageButton Control, with a Hyperlink next to it. 

    Thursday, August 28, 2008 7:08 PM
  • User-1924877455 posted
    Then what is the Text property for, in LinkButton ?
    Friday, August 29, 2008 1:57 AM
  • User-16411453 posted

    I said I think, Not I know for sure If you populate the text property, it places text in between the tags.

    So I tested the idea, and in the browser source, the link button produces an <a> tag.  When you place an image inside it, you get <a><img /></a>

     

    Friday, August 29, 2008 1:00 PM
  • User481221548 posted

    Hi Madhur

    If you want to use serverside Events based on Postbacks, use ImageButton or LinkButton.
    If not, use a HyperLink with filled ImageUrl property.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 31, 2008 11:07 PM