This question is locked. New answers and comments are not allowed.
When I am using Ajax databinding, why can I not do something like this:
and instead have to do this:
I ask because it would be exceptionally beneficial to me to be able to use the first option. Essentially, I have a page with several "widgets", each which make an Ajax request to the server to get the data they need to display. In some cases this can be a JSON result that is evaluated in Javascript in my view, but in other cases (like this), I want to just bind that JSON result to my grid. This way I can have a single method in my controller that takes a WidgetId to get the particular widget and call the GetData() method on that widget (which returns a dynamic).
Otherwise, if I have to use the second option, then I have to have some property on the widget class that determines if the resulting data is for a Telerik control, so I know to use the second option instead of the first option. Which I can do, I would just rather not have to if I can avoid it.
So I guess my ultimate question is, is there a way to use the first option with Ajax databinding? As it stands now, if I use it, I get a 404 response. If I switch it to the second option, the grid populates easily. Thanks.
// dataResult in this case is a dynamic data-type, however resolves to an IEnumerable<>return Json(dataResult, JsonRequestBehavior.AllowGet);and instead have to do this:
return View(new GridModel<ProductViewModel>{ Data = dataResult; // still a dynamic type that resolves to an IEnumerable}I ask because it would be exceptionally beneficial to me to be able to use the first option. Essentially, I have a page with several "widgets", each which make an Ajax request to the server to get the data they need to display. In some cases this can be a JSON result that is evaluated in Javascript in my view, but in other cases (like this), I want to just bind that JSON result to my grid. This way I can have a single method in my controller that takes a WidgetId to get the particular widget and call the GetData() method on that widget (which returns a dynamic).
Otherwise, if I have to use the second option, then I have to have some property on the widget class that determines if the resulting data is for a Telerik control, so I know to use the second option instead of the first option. Which I can do, I would just rather not have to if I can avoid it.
So I guess my ultimate question is, is there a way to use the first option with Ajax databinding? As it stands now, if I use it, I get a 404 response. If I switch it to the second option, the grid populates easily. Thanks.