2.0 Formview question

C

CJ Taylor

I'm using a formview and trying to bind a hyperlink field but can't seem to
get it to work...

I have a control in my <ItemTemplate> declared like this.

<asp:HyperLink ID="hyp_ConfigureBroker" Runat="server"
NavigateUrl='~/Brokers/ConfigureBroker.aspx? gTraderID=<%# Bind("gID")
%>'>Configure</asp:HyperLink>


Anyone know what I'm doing wrong? When it gets built, it doesn't do the
binding..

TIA

CJ
 
J

Jon Stranger

Sadly none of the ...Field controls are available within a FormView
which means that you have to provide all the content as I am sure you
are already aware.

Like you I tried the HyperLink control in the ItemTemplate (using both
Bind and Eval) and I do not understand why it does not work.

The only approach that has worked for me is to create the HTML directly,
i.e:

<a href='targetpage.aspx?ID=<%# Eval("fieldname") %>'>configure</a></p>

but this means that you can't use the '~' reference for the URL.

I guess the only answer is to build the URL in code at runtime.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top