c# - Kendo UI TreeListDataSource Read() only works when running locally -
i have kendo treelist datasource defined as
var ds = new kendo.data.treelistdatasource({ transport: { read: { url: "/home/read/", type: "post", datatype: "json" }}, schema:... }
my controller's read method is:
[httppost] public string read() { log.info("start read()"); var vm = vmhelper.getclientorglistviewmodel(); var json = new javascriptserializer().serialize(vm.facilitylist); log.debugformat("json read returned: {0}", json); return json; }
everything works great long run locally through vs once deploy our staging server, read() transport code never gets executed. 500 error. pressing f-12 view requests in ie shows 500 error
any ideas or suggestions on why works locally not on server , how resolve issue?
try building url using @url.action("read", "home")
var ds = new kendo.data.treelistdatasource({ transport: { read: { url: '@url.action("read", "home")', type: "post", datatype: "json" }}, schema:... }
if javascript code in javascript file won't able use razor helpers. in case add list of url's keep in layout file. this:
<script type="text/javascript"> var configuration; (function (configuration) { var urls = { read: '@url.action("read", "home")' } configuration.url = urls; })(configuration || (configuration = {})); </script>
then use as:
transport: { read: { url: configuration.url.read } }
Comments
Post a Comment