""Walter Wang [MSFT]"" <wa****@online.microsoft.comwrote in message
news:g8******************@TK2MSFTNGHUB02.phx.gbl.. .
Hi Dmitry,
First one is just an example, just to describe an approach if you need to
use some filed instead of the DataKey.
Are you using a multi fields DataKey? Would you please post your complete
code or send me a complete project?
Nope, it is single-field DataKey. The significant difference between your
code and mine is that my link is outside the FormView (see a new line for
link3). This way is doesn't work.
<asp:HyperLink ID="link1" runat="server" Text="Link"
NavigateUrl='<%# String.Format("~/Carrier/AddNew.aspx?id={0}", Eval("Id"))
%>'></asp:HyperLink>
<br />
<asp:HyperLink ID="link2" runat="server" Text="Link2"
NavigateUrl='<%# String.Format("~/Carrier/AddNew.aspx?id={0}",
FormView1.DataKey.Value) %>'></asp:HyperLink>
</ItemTemplate>
</asp:FormView>
<asp:HyperLink ID="link3" runat="server" Text="Link3"
NavigateUrl='<%# String.Format("~/Carrier/AddNew.aspx?id={0}",
FormView1.DataKey.Value) %>'></asp:HyperLink>
Dmitry