Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ctrl+S is DataGrid does not save data
Message
From
03/01/2007 13:13:05
 
 
To
03/01/2007 12:57:18
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
Miscellaneous
Thread ID:
01181178
Message ID:
01181878
Views:
12
I have forgotten completely about the .EndEdit() ... I bet you anything that that's what you need. Silly me!! =0)

In debugging, the DataTable appears to have the correct value in it's DataColumn, however the DataRowVersion is still probably Proposed for that Row.

I always call the following method before I do any saving:
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();
			}
		}
	}
}
Try adding this method and then call it in one of your Save() methods ... I'm almost 100% certain that this is where your problem is.

~~Bonnie



>Bonnie,
>
>I have 3 different classes containing Save() method:
>
>form class Save() - called without parameters from grid. It calls form business object Save() method without parameters.
>
>business object Save() - called without parameters from form. It calls data access object Save() by passing its DataTable and some other parameters you see to data access object.
>
>There exist only one copy of DataTable in my application. This datatable lives in business object and its references are set as grid datasource and passed to data access object Save() method.
>Also, when I press down arrow key before Ctrl+S, save work OK.
>So I do'nt have duplicate datatables.
>
>I can send the whole code to you if you are interested.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform