Problem with Eval() function inside a Template

B

Benton

Hi there,

I have a HyperLink control inside a DataList's ItemTemplate:

<asp:DataList ID="lstDatos" runat="server">
<ItemTemplate>
<asp:HyperLink ID="lnkName" runat="server" CssClass="Link"
Text='<% #Eval("NAME") %>'
NavigateUrl="repInTransitByProvider.aspx?id=<% #Eval('ID') %>">
</asp:HyperLink>
</ItemTemplate>
</asp:DataList>

Eval() works correctly for the "Text" property, displaying the proper name
at runtime.

However, Eval() fails for the "NavigateUrl" property. At runtime, the
resulting hyperlink is exactly like this:

http://localhost:/repInTransitByProvider.aspx?id=<% #Eval('ID') %>

¿Any ideas on what might be happening here?

Regards,

-Benton
 
B

Bruce Barker

when you use a binding expression for a property value, its all that can be
in the value specification.

NavigateUrl = "<%# someexpression %>" is legal binding expression
NavigateUrl = "text<%# someexpression %>" is not a binding expression (just
text)


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,086
Latest member
ChelseaAmi

Latest Threads

Top