Re: Binding Hyperlink.NavigateUrl declaratively

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"densial" <densial@xxxxxxxxx> wrote in message
news:1189723454.951892.23210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Sep 14, 10:21 am, "Dmitry Duginov" <d...@xxxxxxxxxxxxx> wrote:
I have a FormView and a HyperLink on the page.

If I use the following code behind (hooked up to Hyperlink's OnLoad
event),
it renders fine

protected void link_Load(object sender, EventArgs e)
{
link.NavigateUrl = String.Format("~/Carrier/AddNew.aspx?Id={0}",
FormView1.DataKey.Value);
}

However, I was not able to achieve the same goal declaratively, just
using
<%# ... %> syntax in .aspx

Where's the catch?

Dmitry

show us your code for the second one

Any of the following renders just text instead of hyperlink:
NavigateUrl='<%# String.Format("~/Carrier/AddNew.aspx?Id={0}",
Eval("FormView1.DataKey.Value")) %>'

NavigateUrl='<%# String.Format("~/Carrier/AddNew.aspx?Id={0}",111) %>'

NavigateUrl='<%# Eval("FormView1.DataKey.Value") %>'

D.


.



Relevant Pages