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

Custom Binding Example for DataAdaptor

We are building a Blazor WASM app. We have implemented the SfDataManager (along with OData) for the SFDataGrids we are using in our application. It is working well. We have other areas of our application where we require CRUD operations outside of a DataGrid. When we attempt to perform an operation, we are receiving the following error...

"Value cannot be null. (Parameter 'key')"

This seems to be related to the DataManager key property. I was looking at the custom binding (https://blazor.syncfusion.com/documentation/data/custom-binding) documentation and this seems to be the answer by extending/overriding the DataAdaptor class. Do you have an example that we can examine on how to utilize the SfDataManager outside of a DataGrid?

Additionally, if you feel this is not the issue we are facing with the above error, please let us know.


5 Replies

SP Sarveswaran Palani Syncfusion Team January 18, 2023 04:24 AM UTC

Hi Clay,

Greetings from Syncfusion support.

We have analyzed your query, before proceeding further with your requirement kindly share the below details to validate further at our end.


  1. Share us the entire Grid code snippet along with model class
  2. Share us the way you have passed the value to the Grid reference variable
  3. Share the video demo of an issue
  4. If possible, kindly share us the issue reproduceable sample to us


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Sarvesh




CH Clay Hess January 18, 2023 04:05 PM UTC

Perhaps I did not explain myself completely. The DataManager is working well for our datagrids. We are wondering how to utilize it outside of datagrids. For example, if I have a form that requires a CRUD operation, can I use the DataManager? If so, how do I populate the key and other required items?



SP Sarveswaran Palani Syncfusion Team January 25, 2023 03:27 AM UTC

Hi Clay,

Query: if I have a form that requires a CRUD operation, can I use the DataManager?


Yes, it is possible to use data manager outside grid and form as well. Kindly refer the attached documentation links for more understanding of data manager component.

Reference: https://blazor.syncfusion.com/documentation/data/getting-started
              https://blazor.syncfusion.com/documentation/data/data-binding
              https://blazor.syncfusion.com/documentation/data/adaptors
              https://blazor.syncfusion.com/documentation/data/custom-binding

Regards,
Sarvesh



CH Clay Hess January 25, 2023 08:47 PM UTC

I have read through the documentation. I am not able to make DataManager work with EditForm. When my method from OnValidSubmit runs, it runs a method from a class where I extended the SyncFusion DataManager. It hits the method, but when I run the method, nothing gets posted to my API. Here is the code in question...


public async Task<Receipt> SaveReceipt(Receipt receipt)

        {

            Receipt retVar = (Receipt)await InsertAsync<Receipt>(receipt);

            await JsRuntime.InvokeVoidAsync("console.log", retVar);

            return retVar;

        }


All that happens is my receipt object gets returned, but nothing hits my db. As far as the DataManager properties, I set those in the constructor of my class where I extend the DataManager. 



VN Vignesh Natarajan Syncfusion Team February 2, 2023 07:04 AM UTC

Hi Clay,


Sorry for the inconvenience caused.


Query: “ I am not able to make DataManager work with EditForm. When my method from OnValidSubmit runs, it runs a method from a class where I extended the SyncFusion DataManager.”


We would like to confirm that the SfDataManager component can indeed be used to fetch data from an external service and display or bind it to your component. However, it is not possible to perform CRUD operations with the SfDataManager component when it is defined as a standalone component.


In this case, we recommend that you handle the CRUD operations directly in your service externally, using the OnValidSubmit event.


Also, we have considered it as a usability feature and logged a task “Provide support to handle CRUD operation in stand alone SfDataManager component". At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. And this improvement will be included in any of our upcoming releases.

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.

 https://www.syncfusion.com/feedback/40809/provide-support-to-handle-crud-operation-in-stand-alone-sfdatamanager-component 

You can also communicate with us regarding the open feature any time using our above feedback report page. We do not have immediate plan to implement this feature and it will be included in any of our upcoming releases. Please cast your vote to make it count. So that we will prioritize the improvement for every release based on demands.

Please let us know if you have any further questions or if you need any additional information. We are here to help.


Regards,

Vignesh Natarajan



Loader.
Up arrow icon