Linked button in a data table

I am building a data table in my page, one of the items is a pdf icon that corresponds to a number drawn from a query (that exists in the datatable).  I want the pdf button to redirect to a page with a string query corresponding to the number in the dataset when one of them is clicked.  

So if the first one is clicked and the query pulls '23432' as the corresponding number I want that passed in the string query as the browser is redirected.

What is the best way to do this?
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.

Bob LearnedCommented:
What type of ASP.NET web site are you using (Web Forms, MVC, ...)?

What do you mean by "data table"

Are you asking how to generate a dynamic hyper link?

Are you using a GridView?
UnderSevenAuthor Commented:
It is a web form,

I think a dynamic hyper link would do.  The fields come off a data list dynmically populated via a sql query
Bob LearnedCommented:
Can you show me a little of what you are working with please?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

UnderSevenAuthor Commented:
This is the current code that works, but you will see in the commented section what I am trying to do.  Rather than it go straight to a page, I want it to go to a new aspx page via string query.

Protected Sub ddlBills_ItemDataBound(ByVal sender As Object, ByVal e As DataListItemEventArgs) Handles ddlBills.ItemDataBound
            If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
                Dim drow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
                Dim hl As HyperLink = DirectCast(e.Item.FindControl("lnkFormat"), HyperLink)
                Dim sn As String = drow("StatementNumber").ToString()
                Dim req As System.Net.WebRequest
                Dim res As System.Net.WebResponse

                req = System.Net.WebRequest.Create("" & sn & ".pdf")
                'req = System.Net.WebRequest.Create("" & sn)
                ' req = System.Net.WebRequest.Create("/statements.aspx?statement=" & sn)

                '   Try

                '  res = req.GetResponse()

                ' hl.NavigateUrl = "/statements.aspx?statement=" & sn
                hl.NavigateUrl = "" & sn & ".pdf"

Open in new window

Bob LearnedCommented:
That sounds like a Server.Transfer or Response.Redirect with query string arguments passed.  If you attached an event handler to the hyperlink, then you could have a Response.Redirect in the event handler to go to another page.

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
UnderSevenAuthor Commented:
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
Visual Basic.NET

From novice to tech pro — start learning today.