asp.netlinkbutton

Set asp:LinkButton text in markup


How would it be possible to set text of ASP.NET LinkButton like below:

<asp:LinkButton id="LinkButton_Select" runat="server" Text='
<p><%# DataBinder.Eval(Container.DataItem, "Start")%></p>&nbsp;
<p><%# DataBinder.Eval(Container.DataItem, "End")%></p>
'/>

Solution

  • Try this

    <asp:LinkButton id="LinkButton_Select" runat="server" Text='<%# "<p>"+ DataBinder.Eval(Container.DataItem, "Start")+"</p>&nbsp;<p>"+DataBinder.Eval(Container.DataItem, "End")+"</p>"%>'/>