asp:HyperLink build NavigateUrl within Repeater using XPATH data

旧城冷巷雨未停 提交于 2019-12-25 01:23:45

问题


I am using a repeater for some products I am listing.

I'm trying to build an asp:HyperLink NavigateUrl using both hardcoded text as well as XPATH data.

NavigateUrl='mypage.aspx?ID=<%#XPath("THEID")%>&name=<%#XPath("THENAME")%>'

Obviously this isn't working.

Does anyone know how to make this work?


回答1:


This should work:

<asp:HyperLink 
    runat="server" 
    NavigateUrl='<%# string.Format("mypage.aspx?ID={0}&name={1}", XPath("THEID"), XPath("THENAME")) %>' 
    Text="some link" 
/>


来源:https://stackoverflow.com/questions/1813547/asphyperlink-build-navigateurl-within-repeater-using-xpath-data

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