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.
Unfortunately, activation email could not send to your email. Please try again.

Is there way to do complete client-side javascript binding of Grid to JSON collection ?

Thread ID:





106052 Dec 6,2012 09:04 AM Dec 13,2012 11:19 AM ASP.NET MVC (Classic) 2
Tags: Grid
Oleksandr Lysenko
Asked On December 6, 2012 09:04 AM

I have client side javascript that creates/changes JSON collection.
Can I bind Grid to this JSON collection  ?
Will grid be capable to reflect changes made to JSON collection ?
Can you give me an example if so ?

Oleksandr Lysenko
Replied On December 10, 2012 08:43 AM

Does anybody answering in this forum ?

Gowri S [Syncfusion]
Replied On December 13, 2012 11:19 AM

Hi Oleksandr,


Sorry for the delay of response.


We can achieve your requirement by using following script lines to update the datasource with changed JSON Collection :


<script language="javascript" type="text/javascript">

    function addRecord(sender, args) {

        var obj = $find('Grid1').jsonModeMgr.get_dataSource();

        var newrow = obj[0];

        newrow.CustomerID = "OPOP"

        obj.splice(0, 0, newrow);



    function removeRecord(sender, args) {

        var obj = $find('Grid1').jsonModeMgr.get_dataSource();






<div id="addRemoveRecord">

<input type="button" name="Add a Record" value="Add a Record" onclick="addRecord()" />

<br />

<br />

<input type="button" name="Remove a Record" value="Remove a Record"" onclick="removeRecord()" />



Here we have added two buttons one button to add a new row "Add a Record" and another to delete the first row "Remove a Record".


$find('Grid1').jsonModeMgr.get_dataSource() - gets the current datasource.


find('Grid1').jsonModeMgr.set_dataSource(obj) - sets the datasource for the grid with current json collection.


We have created a sample for your convenience. The same can be downloaded from the following link :




Please let us know if you have any other concerns.




Gowri S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.