href='News.aspx?id=<%#Eval(“id”)%>' not work in LinkButton ASP.NET

前端 未结 1 817
再見小時候
再見小時候 2021-01-23 15:37

i want to use href=\'News.aspx?id=<%#Eval(\"id\")%>\' in linkbutton but it is dosent work pleas help me

相关标签:
1条回答
  • 2021-01-23 15:46

    You could use the following:

    <a href="News.aspx?id=<%#Eval("id")%>">Click me</a>
    

    or if you have a LinkButton:

    <asp:LinkButton 
        runat="server" 
        PostBackUrl='<%# string.Format("~/News.aspx?id={0}", Eval("id")) %>' 
        Text="Click me" 
    />
    
    0 讨论(0)
提交回复
热议问题