This question is locked. New answers and comments are not allowed.
Hi there,
I am currently using Asp.net MVC 2010.3.1318 version in my project.
I am trying to bind treeview control through a ajax request to the controller class which will return the JSON object.
I followed the sample give at the following location : http://demos.telerik.com/aspnet-mvc/treeview/clientsidebinding
As far I understand, the treeview control should be able to bind any well-formed JSON object.
I have attached the sample project, you can run it for reproducing the below error.
Homecontroller class will return the string for ajax request, which in turn converted into JSON object and binded to treeview control.
But, I am getting the following error while binding the treeview control : Unable to get value of the property 'replace': object is null or undefined
What am I doing wrong here?
Also, the below link shows an other approach to make an ajax request
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-treeview-client-api-and-events.html
Refer to section : Client Methods / ajaxRequest example
I tried binding the treeview like below :
But, the execution breaks saying that ajax is undefined. Is the above code supported in MVC 2010.3.1318 version?
I didn't missed any JS scripts. I am using the below code in _Layout page
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)))
If I hard code the JSON object and bind it to treeview and then it works fine. Please uncomment the following code in Home/index.cshtml
for testing.
Any help on this will be greatly appreciated.
Regards,
Vara
I am currently using Asp.net MVC 2010.3.1318 version in my project.
I am trying to bind treeview control through a ajax request to the controller class which will return the JSON object.
I followed the sample give at the following location : http://demos.telerik.com/aspnet-mvc/treeview/clientsidebinding
As far I understand, the treeview control should be able to bind any well-formed JSON object.
I have attached the sample project, you can run it for reproducing the below error.
Homecontroller class will return the string for ajax request, which in turn converted into JSON object and binded to treeview control.
But, I am getting the following error while binding the treeview control : Unable to get value of the property 'replace': object is null or undefined
What am I doing wrong here?
Also, the below link shows an other approach to make an ajax request
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-treeview-client-api-and-events.html
Refer to section : Client Methods / ajaxRequest example
I tried binding the treeview like below :
var treeview = $('#ProductsTreeView').data('tTreeView');<
br
>treeview.ajax.selectUrl = '/Home/Products';<
br
>treeview.ajaxRequest();
But, the execution breaks saying that ajax is undefined. Is the above code supported in MVC 2010.3.1318 version?
I didn't missed any JS scripts. I am using the below code in _Layout page
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)))
If I hard code the JSON object and bind it to treeview and then it works fine. Please uncomment the following code in Home/index.cshtml
for testing.
//var jsonObject = [{ Value: "1", Text: "Product 1", Expanded: true, Items: [{ Value: "4", Text: "Product 4", Expanded: true, Items: [{ Value: "6", Text: "Product 6" }, { Value: "7", Text: "Product 7"}] }, { Value: "5", Text: "Product 5"}] }, { Value: "2", Text: "Product 2 (unavailable)", Enabled: false }, { Value: "3", Text: "Product 3"}];
Any help on this will be greatly appreciated.
Regards,
Vara