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

Getting back the modifications made on the client

Hello,

If I try an sample of the treegrid for example, I can on the client make several operations such as create a row, move it, change values, and so on.
But is it possible to "submit" theses changes made on the cclient by a submit button or anything else, and getting the new data on the server side ?

Thanks in advance for your answer.
An example would be greatly appreciated.

1 Reply

PP Pooja Priya Krishna Moorthy Syncfusion Team October 2, 2019 02:36 PM UTC

Hi Marc, 
By using PageMethods, we can get the updated record details in the server side. For this we need to enable EnablePageMethods property in script manager. In the provided sample, we pass the updated records to the server side on button click action. Please find the below code example. 
 
 
[aspx.cs] 
[WebMethod] 
public static void getUpdatedRecords(List<object> record) 
{ 
    //get updated records 
} 
[aspx] 
<input type="button" onclick="getUpdatedRecords()" value="Updated Records" /> 
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="True" /> 
<script type="text/javascript"> 
    function getUpdatedRecords() { 
         var obj = $('#TreeGridControlDefault').ejTreeGrid('instance'); 
         var items = []; 
         for (var i = 0; i < obj.model.updatedRecords.length; i++) { 
             items.push(obj.model.updatedRecords[i].item) 
         } 
         PageMethods.getUpdatedRecords(items); 
    } 
</script> 
 
Please find the below sample link. 
 
Regards, 
Pooja Priya K. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon