Hi team,
Here is my datasource
<SfGrid DataSource="@SODetailsEdit"
@ref="GridDetail"
ID="GridDetail"
TValue="SODetailEdit"
Toolbar="@(new List<string>() { "Add", "Delete" })"
>
and here is my code block upon BeforeBatchSaveArgs or GridDetail.EndEdit();
SODetails = (await SODetailService.GetBySOHeaderID(int.Parse(ID))).ToList();
SODetailsEdit.Clear();
if (SODetails != null)
{
// Details
SODetailsEdit = SODetails.Select(e => new SODetailEdit
{
SODetailID = e.SODetailID,
SOHeaderID = e.SOHeaderID,
SONo = e.SONo,
ItemID = e.ItemID,
ItemCode = e.ItemCode,
Description = "",
WarehouseID = e.WarehouseID,
Quantity = e.Quantity,
UnitCost = e.UnitCost,
TotalCost = e.TotalCost,
}).ToList();
}
StateHasChanged();
Added records id's default is 0 and then gets it corresponding from id from EFCore after saving. My problem is, added record still remains after the update of datasource.
as you can see, id with 0 still remains. it should not already part of datasource.. It should be already coming from saved autonumberID.
there is no saved record with 0 id.
Hope you could help me regarding this matter. regards.
Tyrone
|
public void OnBatchSave(BeforeBatchSaveArgs<Order> Args)
{
foreach (var ord in Args.BatchChanges.AddedRecords)
{
Orders.Add(ord);
}
GridData.Clear();
GridData = Orders;
//After updating the Grid datasource property. Refresh the grid to fetch the updated datasource.
Grid.Refresh();
} |
Hi Vignesh,
I'm still getting the same problem..
please see attached file for my razor and code base..
warm regards,
Tyrone
Thanks Vignesh Natarajan . It worked.