Skip to content

Checking if data in datagridview equal to data in datatable

ahmed fahd

Asked Jan 20, 2013, 7:01 AM EST1 answer
Share
LinkedInX
i want to see if data in the datagridview has changed or not after i selected it from datatable
so i want to compare between datatable data and datagridview data

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Akkiraju Ivaturi
    0
    Before binding data to the gridview, take the dataset copy into another dataset. Now add a new column to the dataset data table which flags if there are changes to the row. Place this dataset in a session variable. Now bind the gridview with the first dataset.

    Whenever you do any changes, flag the appropriate row as changed in the new column that you have added in the dataset in the session variable. After the changes commit the changes to dataset and again assign the dataset to the same session variable.

    Whenever you want to find out if there are any changes, query the datatable in the session variable dataset to find if any of the row has the flag column set to some value.

    Let me know if you have questions on the same.
    0