How to get the cell text of DataGrid

  • Thread starter Thread starter Leo
  • Start date Start date
L

Leo

My DataGrid consists of several columns from different tables. After
user modifies it, I would like to output the text of modified
DataGrid. My question is: how can I get the text of individual cell?

Thanks in advance.
 
I have struggled with this in the past, here are some link I found useful:
interactive datagrids
http://msdn.microsoft.com/msdnmag/issues/01/06/cutting/
asp.net databinding
http://msdn.microsoft.com/msdnmag/issues/01/03/cutting/
http://msdn.microsoft.com/msdnmag/issues/01/04/cutting
http://msdn.microsoft.com/msdnmag/issues/01/05/cutting/default.aspx

Another solution I have found that works well:
The code to get stuff out of the datagrid's cells can get kind of hairy so I have skipped over in place editing and I just put a button column that says "edit" then when they select that row, I use what I know about that row to find the corresponding row in the dataset. (if you show the primary key you can do a DataSet.Rows.Find(key) and that returns a DataRow with the appropriate data. Then I used that to fill a small form at the bottom of the screen. This way all of the data entry code can be centered around a relatively simple, and normal, form. Then you just send all of the values to the proper places, and refresh the dataset and the grid.

I may be wrong about how messy datagrid data entry can be (that project was a while ago). But that is the way I remember it, it just seemed hard to read after the fact. I also would like to see any suggestions from others.

Let me know if I wasn't clear. I hope this helps

-Devin
 
Back
Top