简体   繁体   中英

Eval method, how to bind more than one value?

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

尝试这个:

<%# String.Format("~/Groups/ReportPage.aspx?ReportId={0}&Group={1}", DataBinder.Eval(Container.DataItem, "ReportId"), DataBinder.Eval(Container.DataItem, "GroupId"))%>

You might want to review this.

One way is:

<%# String.Format("{0} - {1}", Eval("Name1"), Eval("Name2")) %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM