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

perform crud operation with server side events with sqlserver

Hi

I want to bind grid on page load with my sqlserver database and do the insert, update ,delete, cancel,save  operation  in grid in inline form edit mode so that effects shows on sqlserver database.

thank you.

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team July 22, 2016 01:17 PM UTC

Hi Sharad, 

Thank you for contacting Syncfusion support. 

As per our understanding about your requirement, you would like to update database while perform crud operation in Grid. In Grid, we have many adaptors to perform crud operations and update the database. Refer to the below document for information about adaptors. 
We have created a sample using WebMethodAdaptor with EditMode as InlineForm. Refer to the help document, sample & code example as below. 
<ej:Grid ID="EmployeesGrid" runat="server AllowPaging="true" > 
                <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" UpdateURL="Default.aspx/Update" InsertURL="Default.aspx/Add" RemoveURL="Default.aspx/Remove" /> 
                <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" EditMode="InlineForm" />              
                <Columns> 
                        <ej:Column Field="OrderID" IsPrimaryKey="true" HeaderText="Order ID" Width="80" /> 
.. 
                    </Columns>                
            </ej:Grid> 
Default.aspx.cs 
// URL Adaptor using server side  
        [WebMethod] 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static object Data(Syncfusion.JavaScript.DataManager value) 
        { 
.. 
            Data = operation.Execute(Data, value);// Execute used for for manual typecasting of columns value while filtering, sorting, or any other data operation 
            return new { result = Data, count = count }; // need to return result and count pair  
        } 
        // Perform Update action 
      [WebMethod] 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static object Update(Order value) 
      { 
//  code for update operation 
      .. 
 
      } 
// Perform Delete action 
      [WebMethod] 
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
      public static object Delete(int key) 
      { 
          .. //  code for delete operation 
 
      } 
        // Perform Add action 
      [WebMethod] 
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
      public static object Add(Order value) 
      { 
.. //  code for add operation 
      } 
 
knowledgebase document for server-side operations : https://www.syncfusion.com/kb/4300/server-side-api-for-datamanager-operations 
Regards, 
Jayaprakash K. 


Loader.
Live Chat Icon For mobile
Up arrow icon