HyperLinkColumn and NavigateUrl

A

Arjen

Hello,

Why is this:
<%# DataBinder.Eval(Container.DataItem, "Id") %>
not working? (I see this in the url... I want to see the id as value)

Complete code:
<asp:HyperLinkColumn DataTextField="From" HeaderText="Van"
NavigateUrl='~/MailMessage.aspx?id=<%# DataBinder.Eval(Container.DataItem,
"Id") %>' SortExpression="From">
</asp:HyperLinkColumn>

Thanks!
 
S

Sami Vaaraniemi

Arjen said:
Hello,

Why is this:
<%# DataBinder.Eval(Container.DataItem, "Id") %>
not working? (I see this in the url... I want to see the id as value)

Complete code:
<asp:HyperLinkColumn DataTextField="From" HeaderText="Van"
NavigateUrl='~/MailMessage.aspx?id=<%# DataBinder.Eval(Container.DataItem,
"Id") %>' SortExpression="From">
</asp:HyperLinkColumn>

Hi,

The aspnet newsgroup would probably be more appropriate for ASP.NET
questions.

Anyway, you need to add the runat="server" attribute. Also note that the <%#
tag is evaluated when you call DataBind for the page or the control. For
more information, check out this tutorial:

http://samples.gotdotnet.com/quickstart/aspplus/doc/webdatabinding.aspx

Regards,
Sami
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi Arjen

you forgot a single SUPER IMPORTANT value
runat=server

Cheers,
 

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

Top