Link to home
Start Free TrialLog in
Avatar of riskyricky1972
riskyricky1972

asked on

asp.net c# gridview

I have asp.net c# gridview and everything is working fine, and I just want to add hyperlink that will be able to carry a value like
primary key. (e.g. http://www123.com/default.aspx?hello=1) the 1 is come from the primary key valve
Avatar of tusharashah
tusharashah

You can add a HyperLink column in your GridView like following:

  <asp:hyperlinkfield DataNavigateUrlFields="PrimaryFieldName"
                    DataNavigateUrlFormatString="http://www123.com/default.aspx?hello={0}"
                    DataTextField="DisplayFieldName"></asp:hyperlinkfield>

Here's Code & Example of this technique:
http://authors.aspalliance.com/aspxtreme/shared/viewsrc.aspx?path=/aspxtreme/sys/web/ui/webcontrols/demos/GridViewHyperLinkField.aspx.src
Avatar of riskyricky1972

ASKER

does not work. The hello={0} is harding code...I want it dynamically loaded from the primary key
hello={0} means "{0}" will get value of the Field specified in DataNavigateUrlFields (dynamic...)

If you look at the code & sample specified in example and scroll over the URL you'll notice the Dynamic ID value coming to each URL
it does not work as the way you said.
ASKER CERTIFIED SOLUTION
Avatar of tusharashah
tusharashah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial