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

RadGrid Assign DataSource in javascript?

1 Answer 344 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 17 Aug 2010, 07:01 AM
I am going to create a RadGrid Control In Client side and want to assign the Datasource from javascript

How to do that,

Here is code what I did so far,

 

var gridXml = "<employees><employee><name>Ram</name><age>25</age></employee><employee><name>John</name><age>30</age></employee></employees>";

 

 

//To Convert xml to Json
var
myJsonObject = xml2json.parser(gridXml);

 

 

//To Create RadGrid
var
radgrid = new Telerik.Web.UI.RadGrid("TestGrid");

 

 

//To Get the Table View  -- But I got Null value while calling this method
var
tableView=radgrid.get_masterTableView();

 

tableView.set_dataSource(myJsonObject );

tableView.dataBind();


But tableview value is null, so how can i assingn datasource to gridview Control from javascript,

Thanks in advance,





1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 18 Aug 2010, 12:43 PM
Hello Ram,

I am afraid you cannot create a new RadGrid on the client. You can create it on the server and data-bind it on the client:

http://demos.telerik.com/aspnet-ajax/grid/examples/client/declarativedatabinding/defaultcs.aspx

http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx

http://www.telerik.com/help/aspnet-ajax/client-side-binding.html

http://www.telerik.com/help/aspnet-ajax/client-side-binding-specifics.html

Greetings,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or