0

I followed the answer on HyperLink with NavigateUrl with Eval(). Where is the mistake?. However it didn't open the page. Would someone tell me how to do it.

My code:

  <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ActionNumber") %>' NavigateUrl='<%# String.Format("/orders/orderAction.aspx?orderID={0}", DataBinder.Eval(Container.DataItem, "ActionNumber")%>)' Target="_blank"> </asp:HyperLink>

I checked the control in html code like this using development tool in IE:

 <a id="dgrd_ctl02_HyperLink1" href='<%#%20String.Format("/orders/orderBasics.aspx?orderID={0}", DataBinder.Eval(Container.DataItem, "ActionNumber")%>)'>VA_QA_5666</a>
Community
  • 1
  • 1
user819774
  • 1,456
  • 1
  • 19
  • 48

2 Answers2

0

In ASP is better to write routes in this way:

  ~/YourRoute/SubRoute

So in your code, you should have:

"~/orders/orderAction.aspx?orderID={0}"
Ed_
  • 973
  • 11
  • 25
0

The parentheses are not quite correct at the end of your NavigateUrl expression:

NavigateUrl='<%# String.Format("/orders/orderAction.aspx?orderID={0}", DataBinder.Eval(Container.DataItem, "ActionNumber")) %>'
ConnorsFan
  • 70,558
  • 13
  • 122
  • 146