asp: HyperLink construção NavigateUrl dentro Repeater usando dados do XPath
-
06-07-2019 - |
Pergunta
Eu estou usando um repetidor para alguns produtos que eu estou listagem.
Eu estou tentando construir um asp:. HyperLink NavigateUrl utilizando texto codificado, bem como dados do XPath
NavigateUrl = 'MyPage.aspx? ID = <% # XPath ( "theID")%> & name = <% # XPath ( "varNome")%>'
Obviamente, isso não está funcionando.
Alguém sabe como fazer este trabalho?
Solução
Isso deve funcionar:
<asp:HyperLink
runat="server"
NavigateUrl='<%# string.Format("mypage.aspx?ID={0}&name={1}", XPath("THEID"), XPath("THENAME")) %>'
Text="some link"
/>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow