+2008-02-25 Igor Zelmanovich <igorz@mainsoft.com>
+
+ * GridView.cs:
+ at Update and Delete use not read only coppies of dictionaries
+ in event argumens, that allows user to change them before corresponding
+ DataSource's method is called.
+
2008-01-23 Vladimir Krasnov <vladimirk@mainsoft.com>
* CheckBox.cs: fiexed RenderInput, should not render RenderInput on
if (causesValidation && Page != null && !Page.IsValid)
return;
- currentEditOldValues = OldEditValues.Values;
-
- currentEditRowKeys = DataKeys [rowIndex].Values;
+ currentEditOldValues = CopyOrderedDictionary (OldEditValues.Values);
+ currentEditRowKeys = CopyOrderedDictionary (DataKeys [rowIndex].Values);
currentEditNewValues = GetRowValues (row, false, false);
GridViewUpdateEventArgs args = new GridViewUpdateEventArgs (rowIndex, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
view.Update (currentEditRowKeys, currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback (UpdateCallback));
}
+ static IOrderedDictionary CopyOrderedDictionary (IOrderedDictionary sourceDic) {
+ OrderedDictionary copyDic = new OrderedDictionary ();
+ foreach (object key in sourceDic.Keys) {
+ copyDic.Add (key, sourceDic [key]);
+ }
+ return copyDic;
+ }
+
bool UpdateCallback (int recordsAffected, Exception exception)
{
GridViewUpdatedEventArgs dargs = new GridViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
public virtual void DeleteRow (int rowIndex)
{
GridViewRow row = Rows [rowIndex];
- currentEditRowKeys = DataKeys [rowIndex].Values;
+ currentEditRowKeys = CopyOrderedDictionary (DataKeys [rowIndex].Values);
currentEditNewValues = GetRowValues (row, true, true);
GridViewDeleteEventArgs args = new GridViewDeleteEventArgs (rowIndex, currentEditRowKeys, currentEditNewValues);