Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check if data has been changed
Message
De
31/10/2007 21:55:31
 
 
À
31/10/2007 21:48:08
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01265117
Message ID:
01265586
Vues:
10
Hi Bonnie,

Does EndEdit have to be explicitly called or when is it called automatically by the framework or the lostfocus of the control or where? I'm not sure what to call everything in C# yet so pardon my ignorance.


>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
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform