We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Update Grid Edit Dialog field values after server side args.Data changes

Hello, 

I have a basic grid with addresses of branch locations and have implemented address verification on the server side. When the user clicks save, the verification runs and if the address needs changes I update args.Data fields accordingly. I would like to cancel the save (this I know how) and update the dialog form with the updated address and have the user verify suggested changes and if they are okay hit save again to save. The second time the user hits Save the address would be be already normalized. 

How can I update the content of the fields in the edit dialog?

 Here is code extract to illustrate the ask:

private async Task ActionBegin(ActionEventArgs<Branch> args)

{


  if (args.RequestType == Syncfusion.Blazor.Grids.Action.Save)

        {

         string oldAddress1 = args.Data.Address1;

          string oldAddress2 = args.Data.Address2;

         string oldState = args.Data.State;

         string oldZip = args.Data.Zip;

          string oldCity = args.Data.City;


// Address Verification code here args.Data is updated with new values


if (AddressNormalized)

{

// display SFDialog informing user how the address changed comparing Original and Normalized

// cancel the save action - the edit form remains open

                args.Cancel = true;

//  Here I need somehow to update the fields in the edit form with the content of args.Data and allow the user to review them and change them. 

}

else

{

// finalize edit, save data and close edit dialogue

}


3 Replies 1 reply marked as answer

BL Balamurugan Lakshmanan Syncfusion Team March 23, 2023 02:21 AM UTC

Hi Nick,


Greeting from Syncfusion support.


From your query, we suspect that you need to update the content of the fields in the edit dialog. We suggest you to use the Edit template to achieve your requirement. Kindly refer the UG documentation for your reference.


https://blazor.syncfusion.com/documentation/datagrid/editing#perform-crud-operation-for-complex-object-using-edittemplate


Kindly get back to us if you have further queries.


Regards,

Bala.


Marked as answer

NP Nick Pisarev March 24, 2023 03:18 PM UTC

Thank you, it works !



SG Suganya Gopinath Syncfusion Team March 26, 2023 03:08 PM UTC

Hi Nick,

We are glad that the provided solution helped to solve the issue. Please get back to us for further assistance. 


Loader.
Up arrow icon