Hello,
When you try to edit last cell in last row of WebDataGrid and then leave this cell with some changes made there's a postback executed (it is caused by unnesessory triggering of "TriggerCommit" event) which is not executed for the cells above of same column and any other cells in the last row.
To repoduce do following:
1 -add grid to page
2 - make last column editable
3 - do not enable Activation Behavior to enable switching between rows without posbacks
4 - double click on any not last cell of last grid column and edit value (see that lost of focus doesn't trigger "TriggerCommit" event)
5 - double click on last cell of last row, edit value and leave this edit box by clicking anywhere on the grid
6 - Misterious "TriggerCommit" is fired and all made changes are lost
I cannot tell any more details about triggering of "TriggerCommit" event as there's no actual callstack for it.
This event is side effect of
/* VS 05/15/2009 Bug 17637. Scrollbars in Firefox do not take focus away from editor *//* remove scroll listeners from containers of grid */var i = this._scrollDIVs ? this._scrollDIVs.length : 0;while (i-- > 0) $removeHandler(this._scrollDIVs[i], 'scroll', this._stopEditHandler);
in
exitEditMode: function (update)
method.
That is all I know for now.Can some one help? This extra event trigger prevents my application fro runniing correctly.
I'm using 10.3.20103.2217 version of control.
UPD: Can this be a reason of descripbed behavior?
/* OK 4/22/2011 73459 - Update of the last row of the grid does not fire RowUpdating Event */_forceUpdateCommit: function ()
Andrey,
I followed your steps and tested this but WDG works normal. I tested it under IE8/IE9. Could this be a browser specific issue?
Maybe if you provide me with sample I will reproduce it.
Thank you
Sample attached please set path to cust.xml here
ds.ReadXml("c:\\cust.xml", XmlReadMode.ReadSchema); (line 124 in LastUpdatable.aspx.cs)
according your local environment.
To reproduce:
1 - Open LastUpdatable.aspx in any browser (I tried IE 9 and FIrefox 13)
2 - Press Edit button to switch grid into edit mode
3 - Edit values in CustNum columns in all rows except last one. See values save changed state when you edit it and switch to another row
4 - Try to edit value (you must change it) of CustNum column in the last row.
5 - Click on any other row. See postback and all values reset to initial state. This should not happen.
There's a workaround for this behevior in attached sample. Uncomment this
//col = new TemplateDataField //{ // Key = "__wondercolumn_to_prevent_last_cell_last_row_edit_failure__", // Width = 0 //}; //col.Header.Text = ""; //this.grid1.Columns.Add(col);
in MakeGrid() and step 5 will not fire PostBack.
How can I avoid this PostBack without adding empty column?
My main goal is to implement multirow update using WDG for .NET 3.5.
.NET 3.5 is requirement. I cannot migrate to .NET 4.0
Regards,Andrey
You also should remove first column of grid by simply deleting this
= new TemplateDataField { Key = "RowIdent", Hidden = false, ItemTemplate = new ImageTemplate { TextFieldName = "RowIdent", ImageConverter = rowView => { DataRowView row = (DataRowView)rowView; if (row["RowIdent"] is int) return ((int)row["RowIdent"] & 1) == 0 ? "error.gif" : "warning.gif"; if (row["RowIdent"] is string) return (int.Parse((string)row["RowIdent"]) & 1) == 0 ? "error.gif" : "warning.gif"; return null; } }
in void MakeGrid()
Hello Andrey,
I can strongly recommend you to use our new “BatchUpdating” feature available for the grid in order to achieve the needed scenario.
Live sample of “BatchUpdating” you can view and test here - http://samples.infragistics.com/aspnet/Samples/WebDataGrid/EditingAndSelection/BatchUpdating/Default.aspx?cn=data-grid&sid=be403a2e-c9bf-4922-b0a4-d17ced5b1e02
Hello, Alex
10v3 does not contain this feature unfortunately. We plan to migrate to 12.1 but now I have to use empty column to make everything work as it should.
Andrey.
Unfortunately usage of batch updating is the main possibility in this situation since grid updating cannot work correctly when Activation behavior is disabled.
Another possibility is to use following guide showing how to simulate Batch updating with grid versions prior to 11.2 - http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=WebDataGrid_Conditional_Batch_Updating_in_WebDataGrid.html
This type of functionality however will be available only for data sources like “ObjectDataSource” and “SqlDataSource” and can be considered as a temporary solution.