R – querystring to a hyperlink in vb.net or maybe another solution

hyperlinkquery-stringvb.net

I am new to vb.net. Let me explain the two aspx pages that i have.
First one is a table with results populated from the sql server backend. The first holds the "FirstName". I want this to have a hyperlink, so when i click on this, it should goto the second aspx page and show all the data in sql server for that "Firstname". the data is in 3 other tables based on firstname, which is phone, address and hobbies.
So –

FirstName
Samuel --> clicked on it

redirect to second page -

Samuel -

Phone        Address        Hobbies
3104445656   123 main st    Climbing

Please tell me if i need a querystring or is there another solution (better solution). Also how do i capture the querystring in second page?

Best Solution

You can generate a link(href) that goes to

secondpage.aspx?firstname=Samuel

and in the code for the second page you can retrieve this value via Request.Querystring("firstname"). But with webforms and postbacks there are other ways of doing this. After getting the selected firstname (preferably in a variable) you can use it for whatever data retrieval methods you want.

Also, I really would recommend against using the name as a key in your database. If this is an experiment to learn, I guess it doesn't matter, but the second you want to enter two people named "John" into your database you have run into trouble.

Related Question