How do I get the value of a DataField in a GridView?

vcbertini
vcbertini used Ask the Experts™
on
So here's what I want to do, and pardon if I'm not using the right terminology.

I have a gridview on my page. The data record is extraordinarly long (about 30+ columns) in the database, so instead of using the built-in "edit" function in the GridView, what I want to do is have the "Edit" field take the user to another page where I have created a Data View setup. This is more user-friendly because the user will only have to scroll vertically instead of horizontally.

The approach I want to take is to pass the ID of the record the user selects to edit from the GridView, put it into a Session Variable, then retrieve it from the Edit page to pull up the appropriate record.  What I don't know is how to find the selected "ID" in the GridView.

First, am I taking the right approach here or did I make it too hard? Is there something built-in to gridview that would be easier than passing variables into a session then retrieving them?

Second, if the variable passing is the most logical approach, how do I access it?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I couldn't get either of the examples to work well as far as putting the ID into a Session variable, but there was a comment on one of the articles that helped a bit, putting the ID straight into the URL of the link button. That's not an ideal solution for me, but it is functional for now. Thanks for the link suggestions.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial