Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Wanna-Be C# Superstar
Posted

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.

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?

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...