This question is locked. New answers and comments are not allowed.
I am using the latest release of the MVC grid. I am trying to get the OnCommand client side event to work but it doesn't seem to be firing. Here is a sample of my code (I am using VB):
As you can see, I added an alert to the Grid_onCommand function just to see if it was reaching the code, and nothing happens. I do get the alert for the onLoad function, so that event is firing correctly.
Can you tell me if there is something else that I need to do?
Thanks.
Dan
<script type="text/javascript">function Grid_onCommand(e) { alert("here"); if (e.name == "cancelChanges") { alert("there"); // pass additional data to the action method using e.data and e.dataItem e.data = $.extend(e.data, { Id: e.dataitem.ArticleId }); }}function onLoad(e) { alert("Grid loaded"); }</script>@(Html.Telerik().Grid(Model) _ .Name("ArticleCategoryGrid") _ .ToolBar(Sub(commands) commands.Insert()) _ .DataKeys(Sub(datakeys) datakeys.Add(Function(dk) dk.ArticleCategoryId) End Sub) _ .DataBinding(Sub(dataBinding) dataBinding.Server.Select("Index", "ArticleCategory", New With {.id = ViewData("ArticleId")}) dataBinding.Server.Insert("Insert", "ArticleCategory") dataBinding.Server.Update("Update", "ArticleCategory") dataBinding.Server.Delete("Delete", "ArticleCategory") End Sub) _ .Columns(Sub(columns) columns.Bound(Function(ac) ac.CategoryId) columns.Bound(Function(ac) ac.StartDate) columns.Bound(Function(ac) ac.EndDate) columns.Bound(Function(ac) ac.ShowLink) columns.Bound(Function(ac) ac.DateCreated).Visible(False) columns.Bound(Function(ac) ac.DateUpdated).Visible(False) columns.Command(Sub(commands) commands.Edit() commands.Delete() End Sub) End Sub) _ .Sortable() _ .Pageable(Sub(p) p.PageSize(10, New Integer() {10, 25, 50}) p.Style(GridPagerStyles.NextPrevious Or GridPagerStyles.Numeric Or GridPagerStyles.PageSizeDropDown Or GridPagerStyles.PageInput) End Sub) _ .Filterable() _ .ClientEvents(Sub(events) events.OnCommand("Grid_onCommand") events.OnLoad("onLoad") End Sub))As you can see, I added an alert to the Grid_onCommand function just to see if it was reaching the code, and nothing happens. I do get the alert for the onLoad function, so that event is firing correctly.
Can you tell me if there is something else that I need to do?
Thanks.
Dan