0

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?

Chase Florell
  • 46,378
  • 57
  • 186
  • 376

1 Answers1

3

This should work:

<asp:HyperLink 
    runat="server" 
    NavigateUrl='<%# string.Format("mypage.aspx?ID={0}&name={1}", XPath("THEID"), XPath("THENAME")) %>' 
    Text="some link" 
/>
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Awesome thanks. Would you be willing to also show how I would add the content of a Textbox into that string as well? – Chase Florell Nov 28 '09 at 20:06
  • You can't do this in server side language as the content might be changed by the user. You will need to use javascript for this. – Darin Dimitrov Nov 28 '09 at 20:12