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

此生再无相见时 提交于 2019-12-02 09:36:20

问题


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


回答1:


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" 
/>


来源:https://stackoverflow.com/questions/9348006/href-news-aspxid-evalid-not-work-in-linkbutton-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!