I want to read the data in a specific cell of a datagrid, or be able to assign the cell value to a variable; Important note: I am new to C#, I spend ours looking, Now I don’t have more time for research although the question is kind of idiotic for someone. Sorry If I am violating any rule of this site, but I ran out of time and need an answer asp.
Asked
Active
Viewed 417 times
0
-
Possible duplicate of [Reading data from DataGridView in C#](http://stackoverflow.com/questions/6487839/reading-data-from-datagridview-in-c-sharp) – Ňɏssa Pøngjǣrdenlarp Aug 10 '16 at 22:49
-
Perhaps [this](https://stackoverflow.com/questions/6487839/reading-data-from-datagridview-in-c-sharp) is what you're looking for? – David Silva Aug 10 '16 at 23:13
1 Answers
0
Try this
YOu can get the value like this :
string str=Gridview_name.Rows[row_index]["Column_name"].ToString();
Assigning value to a specific cell can do similar ways :
Gridview_name.Rows[row_index]["Column_name"] = value;
For more reference here

lakshmi prakasan
- 330
- 4
- 12
-
I have an error, says row_index does not exist in the current content!! a suggestion will be highly appreciated – engel Aug 11 '16 at 01:24
-
Where row_index is an integer representing the index of row in gridview – lakshmi prakasan Aug 11 '16 at 01:30