This question is locked. New answers and comments are not allowed.
Hi,
I am trying to bind telerik mvc Grid on client side using javascript, from the Json object received from server (controller). I get the following error
SCRIPT5007: Unable to get value of the property 'success': object is null or undefined
telerik.grid.min.js, line 1 character 25697
Here is the code I am using.
View
The Controller
Any help please.
regards,
Nirvan
I am trying to bind telerik mvc Grid on client side using javascript, from the Json object received from server (controller). I get the following error
SCRIPT5007: Unable to get value of the property 'success': object is null or undefined
telerik.grid.min.js, line 1 character 25697
View
@using (Ajax.BeginForm("_AddToList", null, new AjaxOptions { OnSuccess = "updateGrid" }, new { id = "frmBulkAddState" })) {
@Html.ValidationSummary();
@Html.TextBoxFor(m => m.Name)
<
input
type
=
"submit"
value
=
"Add To List"
class
=
"t-button"
/>
}
@(Html.Telerik().Grid<
State
>()
.Name("tlkAddToGrid")
.Scrollable(s => s.Enabled(true))
.Columns(col => {
col.Bound(m => m.Id);
col.Bound(m => m.Name);
}))
<
script
type
=
"text/javascript"
>
function updateGrid(json) {
var grid = $('#tlkAddToGrid').data('tGrid');
grid.dataBind(json);
}
</
script
>
The Controller
public
JsonResult _AddToList(State state) {
List<State> states = Session[
"AddToList"
]
as
List<State>;
states.Add(state);
Session[
"AddToList"
] = states;
return
Json(states, JsonRequestBehavior.AllowGet);
}
Any help please.
regards,
Nirvan