Hi,
I am working on a grid that allows the user to append new items (lines). When a user clicks in the first sell of a new row a form pops up where the user can select an item. This is done in the AfterCellActivate event. After selection, the selected item is added to the bound item an two cells are updated (serialnumber and name).
Now when the new row is leeved for example by click in another row or click in another control, the whole row is lost.
Before I displayed the select form in BeforePerfomAction with the NextCellByTab action. Here it worked fine.
What am I doing wrong in this new scenario? I also tried to Perform the CommitRow action manually but with not effect.
Kind regards
Patrick
Hi Patrick,
My guess is that it's something about the way in which you are adding the new row, but it's impossible to say, since you didn't mention exactly what you are doing there.
What kind of DataSource are you using here?
Are you adding the new row to the DataSource or to the grid? It generally makes more sense to add the row directly to the data source, unless you want the user to be able to cancel it.
If you can post a small sample project demonstrating the issue, I would be happy to take a look and I'm sure I could tell you what's wrong and how to fix it.
Hi Mike,
now I isolated the problem with a solution attached to this post. After having started just do the following:
The new row disappears.
The row remains as expected.
Can you see what I am doing wrong?
Kind regards and thanks for your helpPatrick
thanks for the reply. What I am doing ist very simple. The grid is bound to a list of orders which is a class of my own and it allows to add new rows at the bottom (AllowAddNew.TemplateOnBottom).
I just click in the new line array and the new line is added. This works as long as I enter some data in a cell manually. What I am doing now is display a dialog after having entered the first column of the row. Therefore I use the OnAfterCellActivate event.
private void OnAfterCellActivate(object sender, EventArgs e){ if (sender == this.OrderGrid) { if (this.OrderGrid.ActiveCell.Column.Key == "DeviceSerialNumber") { PerformDeviceSerialNumberInput(); } }}
...order = this.OrderGrid.ActiveRow.ListObject as Order;...order.Device = device;this.OrderGrid.ActiveRow.Cells["DeviceSerialNumber"].Value = order.Device.SerialNumber;this.OrderGrid.ActiveRow.Cells["DeviceName"].Value = order.Device.Name;this.OrderGrid.Refresh();...
This is all. Aslong as I haven't changed any other field content in this row, it disappears when i activate anothher control or another row.
Kind regards Patrick