Sunday, November 19, 2006

Get Values From Grid View To Update it

Hi Folks,

i got a question from one of our boomers to how can he get values from gridview to update values.
here,is the answer.

Way #1 :
string test = MyGV.Rows[indx].Cells[1].Text ;

Way #2 : if you want to get DataKey value from GridView
string test=MyGV.DataKeys[0].Value.ToString()

Way #3:

((GridView)e.CommandSource).Rows[0].Cells[2].Text


let me know if you need any other help my friend "Raheel Rasheed".


Regards,
Moustafa arafa

4 comments:

Unknown said...

can you plase tell how retrieve new values . thanks in advance..

Unknown said...

to retrieve the new values,use 3rd way because it seems that your column is not a datakey column.

if you need any other help please let me know.

Anonymous said...

how do i get the the datakey of a row which i selected so i can use that key for futher operations like update ect.

Anonymous said...

addition to my post the 3rd technique does not tell which method to place it in. Would like to do this in a RowCommand when a press a button.