|
Rank: Advanced Member Groups: Member
Joined: 2/11/2008 Posts: 37
|
If you run your demo "Edit Grid Data - Excel Style" after editing the data in the demo.mdb file, setting a few of the datetime's in the Topics table to null, then when you set a date for the previously null field and click the postback button, the new value is not saved.
Am I doing something wrong? Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
The Grid can populate its initial value from your data source, but it never saves the data back into your data source for you. All the changes are kept by the Grid and you will need to handle its server side event to save the changes. A normal flow is like this:
1. Grid populates from your data source; 2. User modifies the data; 3. ItemChanged event is fired; 4. Your code checks the Grid's ChangedItems property and saves the change back to your data source;
Note step 4 is done by your code, not he Grid.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 2/11/2008 Posts: 37
|
Ok, let me be more clear.
The new value does not show in the ChangedItems list. The cell shows as modified but the new value is missing. I used your own demo as an example so that you wouldn't think I coded anything wrong. All you have to do to see the problem is set some date values to null in your demo.mdb.
Thank you.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Sorry that we have missed the point! :) We have posted a new build (2007.2.50) that fixed this issue. Please see your private message for download location.
|
|
Rank: Advanced Member Groups: Member
Joined: 2/11/2008 Posts: 37
|
Build 2007.2.50 does fix this problem, thank you.
I will note that if you click on a datetime cell that was null, and then postback, the new value for that cell in ChangedItems is "1/1/0001 12:00:00 AM". I'd prefer it to be "" or something but I can live with it as is.
Thanks again.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Thanks for your feedback. DatePicker does not have a null value, that's why as soon as you edited the cell, you no longer have the null value. The value is changed to DateTime.MinValue so that it can be distinguished whether user has edited the cell and also facilitate some whose database does not accept null value.
|
|
Rank: Advanced Member Groups: Member
Joined: 2/11/2008 Posts: 37
|
Ok, thanks again.
|
|