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 18:54:06
 
 
To
01/01/2007 16:20:26
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
Miscellaneous
Thread ID:
01181178
Message ID:
01181254
Views:
12
Wow, it doesn't work? I tried it several different ways before I replied to you originally. I tried it by using three different possiblities for data.
MyGrid.DataSource = MyDataSet;
MyGrid.DataMember = "MyTable";
MyGrid.DataSource = MyDataSet.Tables[0];
MyGrid.DataSource = MyDataSet.Tables[0].DefaultView;
In all three cases, the CurrencyManager.Refresh() correctly "saved" the current cell to the data's row/column. I put a breakpoint in my grid sub-class and checked the value of
((DataSet)DataSource).Tables[DataMember].Rows[this.CurrentCell.RowNumber][this.CurrentCell.ColumnNumber]
in the ImmediateWindow both before and after the .Refresh(). It was the old value before the refresh and the new value after the refresh. If you haven't tried this, try it first ... it may be something else that's causing it to not work, but off the top of my head I have no ideas.

How *are* you setting the grid's DataSource BTW? (and ... are we talking about DataGrid or the new DataGridView? I tried this with the old DataGrid).

~~Bonnie



>>enough, what seems to work correctly in this case is to Refresh the CurrencyManager.
>
>Thank you.
>I tried this, but results are exactly same.
>
>Ctrl+S does not save data.
>New value remains in column and is not saved even after I move to new row.
>
>If I move to new row before saving, Ctrl+S works OK.
>
>So Refresh() and EndEdit() are exactly the same.
>
>Any idea how to solve this ?
>
>I studied the following resources but havent found any solution:
>
>1. Visual C# 2000 help file
>2. www.syncfusion.com/FAQ/WindowsForms
>3. winforms.controls newsgroup in news.microsoft.com
>4. codeproject.com
>5. Book Windows Forms Programming in C# (2003) By Chris Sells
>6. Book Data binding with Windows Forms 2.0 (2006)
>
>What other resources are avaliable for WinForm grids ?
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