Hi,
We are using XamGrid 10.3, we have following requirement:
We have "Add New Row" in top row of xamgrid, it has 4 columns "Security(editable), Description, Quantity(editable), Status".
1. on entering security, for ex: MSFT, I need to hit a WCF service and pull description
2. on entering Quantity, I need to hit another WCF service, and see if it is available I need to set the status to available or else rejected; and then need to add the whole row to grid so that user can add another security info.
can you pls help on below questions:
1. How can I update the Add new row values once I get security description/status from server?
2. How can I trigger the event to add this new row to actual row collection on tab out of Quantity?
regards,
kthatik
So you can get access to the AddNewRow's data like this:
((RowsManager)this.xamGrid1.Rows[0].Manager).AddNewRowTop.Data
Or, if you're in a row event, by using:
e.Row.Data
So, while you're waiting for Quantity to be returned from the server, you should handle the RowExitingEditMode event.
if (e.Row.RowType == RowType.AddNewRow), and you haven't gotten Quantity back yet, you should set e.Cancel = true.
Once you get it back, you can handle, the RowAdding event, and check to see if you're allowed to add, if not, then set e.Cancel to true in that event.
Hope this helps,
-SteveZ
Hi Steve,
Thanks for your reply, it worked partially, have few questions:
1. How can I trigger row adding event in code-behind, i.e on entering Quantity, I want to add that new row to grid rows collection, and have it empty for taking new input.
2. How can I show the newly added row always at the top of the grid, I've "Last Updated" column in grid, I set it's 'IsSorted' property to Descending, but still it is adding at the end of the grid.
Kthatik
So, you can just add the row yourself manually:
this.grid.Rows.Add(yourRow);
As for having it show at the top, if you want it done by sort order, then just call
this.grid.InvalidateData();
That will cause all data operations to be invalidated, so your new item should be taken into account.