2.0 Formview question

  • Thread starter Thread starter CJ Taylor
  • Start date Start date
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
 
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.
 
Back
Top