Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ctrl+S is DataGrid does not save data
Message
From
01/01/2007 10:14:18
 
 
To
01/01/2007 07:12:21
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
Miscellaneous
Thread ID:
01181178
Message ID:
01181196
Views:
17
Andrus,

I have found that the .EndCurrentEdit() does not always work. Strangely enough, what seems to work correctly in this case is to Refresh the CurrencyManager. So, your code should look like this:
  case Keys.Control | Keys.S:

    ((CurrencyManager)BindingContext[
				DataSource, DataMember]).Refresh();
    ((BusinessForm)FindForm()).Save();
    break;
~~Bonnie

>I have Winforms C# DataTable bound to DataGrid.
>User edits cell and press Ctrl+S without leaving cell.
>Edited data is not saved to database.
>When user moves to other row, save works OK.
>
>How to save without leaving cell ?
>
>I have the following code in DataGrid subclass :
>
>protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
> if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) {
>switch (keyData){
>
> case Keys.Control | Keys.S:
>
> ((CurrencyManager)BindingContext[
> DataSource, DataMember]).EndCurrentEdit();
> ((BusinessForm)FindForm()).Save();
> break;
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