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
close icon

No api - CRUD

I'm using a mixed table data to feed a Grid, so it isn't possible to make changes directly.
How can I use the grid making update/insert/delete on the page razor code
I don't want to use API controller calls.

3 Replies

RS Renjith Singh Rajendran Syncfusion Team December 23, 2019 01:53 PM UTC

Hi Armando, 

Thanks for contacting Syncfusion support. 

Based on your requirement, we suggest you to use the custom way of binding data to Grid, using CustomAdaptor of EjsDataManager. Please refer the documentation link for more details regarding this topic, 
Documentation :  

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



AC Armando Costa December 23, 2019 02:24 PM UTC

I wanted something simpler like OnUpdate="execute", and no dataset updates deletes or inserts from grid
The code gets very dense for nothing.
Less code, easier to read and correct.

In that case, what happens when I don't override a function ? 




RS Renjith Singh Rajendran Syncfusion Team December 24, 2019 12:06 PM UTC

Hi Armando, 

Based on your requirement, we have prepared a simple sample to perform only update action using CustomAdaptor. Please download the sample from the link below, 
 
The above attached is a simple sample to perform only the update action and we have not added any other codes to perform other operations like sorting, filtering etc. Please refer the below code to perform only update action in Grid using CustomAdaptor, 

 
<EjsGrid TValue="Order" ID="Grid" AllowPaging="true" Toolbar="@(new List<string>() { "Edit", "Update", "Cancel" })"> 
    <EjsDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></EjsDataManager> 
    <GridEditSettings AllowEditing="true" Mode="@EditMode.Normal"></GridEditSettings> 
    ... 
</EjsGrid> 
 
@code{ 
    public static List<Order> Orders { get; set; } 
    ... 
 
    // Implementing custom adaptor by extending the DataAdaptor class 
    public class CustomAdaptor : DataAdaptor 
    { 
        // Performs data Read operation to bind Data to Grid at initial loading 
        public override object Read(DataManagerRequest dm, string key = null) 
        { 
            ... 
           return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource; 
        } 
        // Performs Update operation 
        public override object Update(DataManager dm, object value, string keyField, string key) 
        { 
            //Handle your custom update operation and return the value 
            return value; 
        } 
    } 
} 


We would like to explain you the behavior of Syncfusion custom binding. We have Read/ReadAsync, Insert/InsertAsync, Remove/RemoveAsync, Update/UpdateAsync, BatchUpdate/BatchUpdateAsync methods to perform the Search, Filter, Sort, Paging, CRUD actions in a custom way(you can add these methods to your application based on your requirement).  
 
Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Live Chat Icon For mobile
Up arrow icon