Create Dynamic Hyperlink in DataGrid Column

I have a project that i am working on.
And this project has a DataGrid in the file

Here is what i want to accomplish
i want to have the last column of my datagrid be a dynamic link.
ITEM ID             Descrip                    item_details
2161                 some item                 Details <------------i want this to be a link that looks like this

there is a list of about 21000 items so dynamicly is the the only way.
So how should i do this in Visual Studio?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this....
Firstly you'll need to take a template column.
In the template column, take a hidden control and a literal control.

Bind the hidden control value to something like
<asp:HiddenField id="hdnId" runat="server" value='<% #DataBinder.Eval(Container.DataItem,"ItemID") %>' />
And the literal control should look something like this.

<asp:Literal id="litLink" runat="server" />
Now in the ItemDataBound event of the gridview write this

I think this should work...

Literal litLink=(Literal)e.Row.FindControl("litLink");
HiddenField hdnID = (HiddenField)e.Row.FindControl("hdnId");
litLink.Text = "<a href=''"+hdnID.value+">"

Open in new window

phoenixfire425Author Commented:
i tried what you said and it did not work.
however i did get this to work.

<asp:HyperLinkField DataNavigateUrlFields="order_no" DataNavigateUrlFormatString="OrderDetail.aspx?order_number={0}"
                    DataTextField="order_no" HeaderText="Order_details" SortExpression="order_no"
                    Target="_blank" />

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.