This is a migrated thread and some comments may be shown as answers.

How to bind a Grid on client side to JSON Data WITHOUT WebService or WebMethode?

1 Answer 287 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dirk
Top achievements
Rank 1
Dirk asked on 22 Jul 2013, 12:39 PM

I’m currently working in a SharePoint 2010 environment and need to bind a telerik ASP.Net AJAX Grid (latest version) to some JSON data that is created by an ASHX handler.

Prerequisites:

  • I need to use the JSON output from the ASHX handler and can’t build/deploy my own WCF Service
  • I need to wrap the Grid in a SharePoint 2010 WebPart (ascx) so I do not want to use WebMethods from an ASPX page

 

I have searched the forum and the web but was not able to find a sample that does not use a WebMethod or a WCF service. Can someone please point me in the right direction for this scenario?

Thanks in advance
Dirk

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 25 Jul 2013, 06:23 AM
Hello Dirk,

In order to achieve your scenario you could use the RadGrid programmatic client-side binding mechanism. You could use the JSON data to convert it to JavaScript Array and then call the GridTableView set_dataSource client-side method and then call the dataBind method in order to populate the grid data as shown below.
function populateRadGrid()
{
    var data; // your data
    var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
    masterTable.set_dataSource(data);
    masterTable.dataBind();
}

Regards,
Antonio Stoilkov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Dirk
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or