This question is locked. New answers and comments are not allowed.
Hi
I have a grid that is is Ajax bound. I did this so that I could use the OnRowDataBound event to enable/disable the edit and delete buttons based on certain criteria. This works as expected. The problem is that the delete command does not work when using only Ajax binding. The delete action looks like this:
However, when called, I get a javascript syntax error in terlerik.grid.min.js:
I have a grid that is is Ajax bound. I did this so that I could use the OnRowDataBound event to enable/disable the edit and delete buttons based on certain criteria. This works as expected. The problem is that the delete command does not work when using only Ajax binding. The delete action looks like this:
| [HttpPost] |
| [GridAction] |
| public ActionResult RemoveActivity(Guid activityId) |
| { |
| ... |
| } |
success
:b.proxy(function(g){g=eval("("+g+")");
Changing the parameter to Guid ?activityId, doesn't cause the javascript error, but the parameter is then always null.
If I change the grid to use server binding, the delete works, but the OnRowDataBound event is not called.
My grid definition looks like this:
| <% |
| Html.Telerik().Grid<ActivityModel>() |
| .Name("CurrentActivitiesGrid") |
| .Scrollable(scrolling => scrolling.Height(300)) |
| .DataKeys(keys => keys.Add(a => a.ActivityId)) |
| .DataBinding(dataBinding => |
| dataBinding.Ajax() |
| .Enabled(true) |
| .Select("LoadActivities", "EngagementPlanning") |
| .Update("UpdateActivity", "EngagementPlanning") |
| .Delete("RemoveActivity", "EngagementPlanning") |
| ) |
| .Columns(columns => |
| { |
| columns.Command(commands => |
| { |
| commands.Edit(); |
| commands.Delete(); |
| }).Width(200).Visible((Boolean)ViewData["AllowEdit"]); |
| columns.Bound(a => a.ActivityId).Visible(false); |
| columns.Bound(a => a.ActivityName).Title("Name"); |
| }) |
| .ClientEvents(events => |
| { |
| events.OnError("OnGridError"); |
| events.OnRowDataBound("OnActivityRowBound"); |
| events.OnLoad("OnActivityGridLoaded"); |
| }) |
| .Footer(false) |
| .Render(); |
| %> |