Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if data has been changed
Message
From
01/11/2007 16:59:04
 
 
To
31/10/2007 21:48:08
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01265117
Message ID:
01265895
Views:
8
>Hi Eduardo,
>
>>It works fine if I change record. Dataset.Haschanges(), seems to do the same.
>>But for it to work the user has to move from the record. If he makes modifications to the data and close the form, Rowset or Haschanges are not aware of the change.
>>What I am trying to do is Enable a save button from my datanavigator as soon as the user modifies a field in the form.

>
>There's a little "gotcha" with this, and it's caused when the data in a row has been left in a Proposed state.
>
>Data in a DataRow has several different versions. First, there's the original version. Then, when it's being edited, it becomes a Proposed version and once it's done being edited it becomes the Current version. Sometimes when editing, the row is left in the Proposed state and needs to be ended.
>
>Here's a method I *always* call before I attempt to save data:
>
>
>protected virtual void CommitProposedChanges(DataSet ds)
>{
>	if (ds == null)
>		return;
>
>	for (int nTable = 0; nTable < ds.Tables.Count; nTable++)
>	{
>		for (int nRow = 0; nRow < ds.Tables[nTable].Rows.Count; nRow++)
>		{
>			if (ds.Tables[nTable].Rows[nRow].HasVersion(DataRowVersion.Proposed))
>			{
>				ds.Tables[nTable].Rows[nRow].EndEdit();
>			}
>		}
>	}
>}
>
>
>Without calling the above method, .HasChanges() could return a false when in fact there is a Proposed change just waiting to be committed.
>
>~~Bonnie

Thanks for your time Bonnie, it works perfectly, when I close the form.

How do you use this method to enable or disable the toolbar buttons.? If the user makes changes in a textbox or a grid.

Thanks for your help
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform