How to set Querystring values in <asp:HyperLinkField > in GridView

<Columns>
<asp:HyperLinkField NavigateUrl="~/test.aspx" ShowHeader="False" Text="View/Edit" />
</Columns>

<%# Eval("product_id") %>
kengkitAsked:
Who is Participating?
 
tetorvikConnect With a Mentor Commented:
I'm sorry, my pointer really did fit to hyperlinkfiels. try following instead:

<Columns>
<asp:BoundField DataField="code" HeaderText="Product Code" />
<asp:HyperLinkField DataNavigateUrlFields="product_ID" DataNavigateUrlFormatString="product_spec.aspx?action=edit&ID={0}" ShowHeader="False" Text="View/Edit" />
</Columns>

Open in new window

0
 
tetorvikCommented:
0
 
kengkitAuthor Commented:
i got the following error:

Error Creating Control - GridView
Databinding expressions are only supported on objects that have a DataBinding vent. System.Web.UI.WebControls.HyperLinkField does not have a DataBinding event.
<Columns>
<asp:BoundField DataField="code" HeaderText="Product Code" />
<asp:HyperLinkField 
NavigateUrl='<%# String.Concat("product_spec.aspx?action=edit&ID=", Eval("product_ID")) %>' ShowHeader="False" Text="View/Edit" />
</Columns>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.