Trying to update using dapper and Dialog box

When using the dialog box to update a task using dapper what event is called when save is pressed.  Yes it updates the model but we want to send the request to the database. 

We tried using the rowupdatedhandler but while it updates the record, it does not close the dialog box and freezes the page.



2 Replies

TO Tony O'Brien September 23, 2024 06:26 PM UTC

We spent hours on this, as it made no sense.  2 things ended up working.  

1)  We put out update query in a function and called it from the RowUpdatedHandler() function.  This solved the problem, but begged the question why?  Turns out that it was the sql command call (likely dapper related.)
2) The command was set for queryasync, and we suspect it was hanging because it was waiting for a record-set to be returned. Since this was an update statement, we changed the call in the service to execute vs queryasync,  and doing so allowed us to call the service without using the secondary function.

Hope this helps others.



AG Ajithkumar Gopalakrishnan Syncfusion Team September 27, 2024 12:49 PM UTC

Hi Tony,

Greetings from Syncfusion Support,

We are unable to replicate the issue when dapper using with Gantt chart. We have attached an video for reference and sample refer it.

Video reference:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/custom1021182171.zip

We have verified that the CRUD actions and taskbar edit actions are saving properly in the database without freezing. We are using a service for database for updating the data. We have attached the code sample for reference and suggest using a separate service or controller for backend updates.

Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp-851887978.zip

public class CustomAdaptor : DataAdaptor

{

    private readonly GanttDataAccessLayer _dataLayer;

    public CustomAdaptor(GanttDataAccessLayer dataAccessLayer)

    {

        _dataLayer = dataAccessLayer;

    }

    public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)

    {

        List<TaskModel.TaskInfoModel> records = await _dataLayer.GetEmplyoeeListAsync();

        int count = records.Count();

        return dataManagerRequest.RequiresCounts ? new DataResult() { Result = records, Count = count } : (object)records;

    }

    public override async Task<object> InsertAsync(DataManager dataManager, object data, string key)

    {

        await _dataLayer.AddEmployeeAsync(data as TaskModel.TaskInfoModel);

        return data;

    }

    public override async Task<object> UpdateAsync(DataManager dataManager, object data, string keyField, string key)

    {

         await _dataLayer.UpdateEmployeeAsync(data as TaskModel.TaskInfoModel);

        return data;

    }

    public override async Task<object> RemoveAsync(DataManager dataManager, object primaryKeyValue, string keyField, string key)

    {

        await _dataLayer.RemoveEmployeeAsync(Convert.ToInt32(primaryKeyValue));

        return primaryKeyValue;

    }

}


Documentation reference in Grid:- https://blazor.syncfusion.com/documentation/common/data-binding/dapper-databinding

We request you to share more information to achieve your requirement. Kindly share the details below.

  • Code snippet of the Gantt chart with the patch version.
  • The details about the databinding using in sample.
  • Have you faced the issue in any specific scenario or when enabling specific properties?
  • A video demo to replicate the issue, including replication steps.


Once we receive this information, we will be better equipped to identify the root cause of the issue and provide you with the necessary assistance.


Regards,

Ajithkumar G


Loader.
Up arrow icon