2

I want to pass two values with a navigate URL using Eval method, but it doesn't take more than one value. Here is my code

<asp:HyperLink ID="HyperLink1" runat ="server" Text='<%#Eval("ReportTitle") %>' NavigateUrl='<%# Eval("ReportId","GroupId","~/Groups/ReportPage.aspx?ReportId={0}&Group={1}")%>' > </asp:HyperLink>

But I have this error(Error3 No overload for method 'Eval' takes 3 arguments) so how can i do what i want to?

Thanks

Ruba
  • 885
  • 4
  • 18
  • 29

2 Answers2

8

Try this:

<%# String.Format("~/Groups/ReportPage.aspx?ReportId={0}&Group={1}", DataBinder.Eval(Container.DataItem, "ReportId"), DataBinder.Eval(Container.DataItem, "GroupId"))%>
Kyle Trauberman
  • 25,414
  • 13
  • 85
  • 121
Peter Mourfield
  • 1,885
  • 1
  • 19
  • 38
4

You might want to review this.

One way is:

<%# String.Format("{0} - {1}", Eval("Name1"), Eval("Name2")) %>
Community
  • 1
  • 1
CodingSlayer
  • 883
  • 1
  • 7
  • 14