You need to capture changed value events, then modify and save the dataset
before rebinding the controls. Load your old dataset in Page_Load. When the
TextChanged event fires for your textbox you can either update the dataset
then or set a flag to do it later. For the datagrid you either handle
EditItem update events or scavenge the entire datagrid for changed values.
Then in Page_PreRender you call code to save the changed dataset just before
binding the controls to their values.
You probably want to make sure the save succeeds before binding the data;
I normally just reload dataset right after saving it to make sure, but you
can do that conditionally if performance matters. BTW I recently read an
article by Scott Mitchell entitled "Why I Don't Use DataSets in My ASP.NET
Applications" -- you might want to take a look at it:
http://aspnet.4guysfromrolla.com/articles/050405-1.aspx
"EDom" wrote:
> Hi,
> On my page I have dataset values displayed in text box and datagrid. After I
> make any change on the text boxes which do not immediately effect the value
> in the dataset. How can I know if the dataset is dirty. I mean how can I
> capture if any change was done to the values in the controls on the page to
> prevent the user from escaping without saving changes
>
> Regards
>
>
>