How do you get data from gridview with select command? I have a populated gridview, I select a row, it highlights... Now how do I get access to that selected information? Do I have to go back to DB, or can I somehow pull the selected data. Asp.net 3.5 VS 2008 C#

I assume there is some sort of method? gridview1.selectedsomething(0); ?? I have been looking through them, don't see anything that could be it.

suppose u have label in gridview when you select the row..

go to DataBound Event..

Check first is the DataItem.

next

use

var yourlabelid = e.item.findcontrol("yourlabelid") as Label;

response.write (yourlabelid.Text);

or do some operations..

i hope that's wot you asked..!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.