Using a Dataset with a Diff

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I have a gridview that I fill by binding it to a dataTable. Then I let the user make modifications to check boxes in the grid. When they are done they click a button and I need to run some stored procs for the changes they made.

Is there a simple way for the DataTable to tell me which rows have been modified?

I know this is what a diffGram is supposed to do. My data is not coming from xml and I don't want ADO.NET taking care of anything more than just telling me what changed. I'm reading alot about how .NET can run and update my data for me and such. I'm not ready to give that control over yet.

Any suggestions?
 
A little more information that I gathered from searching. There is a RowState property on all rows in a DataTable that will tell me if the row has been modified and will give me the original and modified values which is exactly what I need.

But I can't get at my GridView's data source which I know is a DataTable.
Code:
gv.DataSource = myDt;
//will bind my grid 

//but after postback
DataTable dt = gv.DataSource as DataTable
//only returns null

//i do have viewstate enabled because I can get at
 foreach (GridViewRow gvr in gv.Rows)
            {
                DataControlRowState drs = gvr.RowState;
            }

But the DataControlRowState is not the same as the RowState on a DataRow and it doesn't have the same capabilities.

How can I get my dataTable back from the source of the gridView with the user changes?
 
Back
Top