This question is locked. New answers and comments are not allowed.
I have a telerik MVC grid that i'm trying to add editing to. Basically, it exists in a partial view and has the following:
This code works GREAT. I also have a way to insert new data that is outside of the grid (necesary for my purposes). This is an Ajax.BeginForm that is in the parent layout:
Simple stuff. This works GREAT too, no problems.
The only issue is when i try to add a command. Changing the grid code to :
Note, ALL i did was add a delete command. now the grid works great still, the delete works good, but my ajax.beginform is broken. when i click on the submit button in my ajax.beginform, i get 2 javascript errors, both the same:
c.validator.methods[e] is undefined
Now, if i use a custom command it doesn't break anything, but I don't like that solution because it doesn't help me when i try for 'Edit' (which breaks my ajax beginform as well).
Why is the grid breaking my ajax.beginform?
Html.Telerik().Grid<DGI.CoBRA.Web.BusinessObjects.FullLogEntry>(Model).Name("loggrid").DataKeys(keys =>{ keys.Add(p => p.LogEntryGUID).RouteKey("LogEntryGUID");}).Columns(columns =>{ columns.Bound(o => o.FriendlyUserName ).Width(120).Title("User"); columns.Bound(o => o.EventDescription).Template(@<text> @if (item.Priority == DGI.CoBRAPlugInSDK.LogPriority.High) { <span style="color: #FF0000">@item.EventDescription</span> } else { <span>@item.EventDescription</span> } </text> ) .ClientTemplate("<# if (Priority==30) {#>" + "<span style='color: #FF0000'><#=EventDescription#></span>" + " <#} else {#>" + "<span><#=EventDescription#></span>" + " <#}#>"); columns.Bound(o => o.FormattedDateCreated).Width(120).Title("Date Created");}).DataBinding(dataBinding =>{ dataBinding.Ajax().OperationMode(GridOperationMode.Client) .Update("_UpdateLogEntry", "Notes", new { area = "Tools", id = @Model.ProjectGUID }) .Delete("_DeleteLogEntry", "Notes", new { area = "Tools", id = @Model.ProjectGUID }) .Select("_GetLogList", "Notes", new { area = "Tools", id = @Model.ProjectGUID });} ) .ClientEvents(events => events.OnRowDataBound("onRowDataBound")).Scrollable(scrolling => scrolling.Enabled(false)).Sortable(sorting => sorting.Enabled(true))//.OrderBy(order =>order.Add(o => o.DateCreated))).Pageable(paging => paging.Enabled(true)).Filterable(filtering => filtering.Enabled(true)).Groupable(grouping => grouping.Enabled(false)).Footer(true).Render();@using (Ajax.BeginForm("AddNewNote","Notes", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", UpdateTargetId = "divnotelist", OnBegin = "StartProg", OnComplete = "StopProg" })){ <script type="text/javascript"> function StartProg() { $('#progressbar').show(); } function StopProg() { $('#progressbar').hide(); $('#NewNoteText').val(''); $("#NewNoteText").focus(); } </script> <div id="newnote" style="text-align: center;"> <p> @Html.HiddenFor(m => m.ProjectGUID) <span class="editor-field">@Html.TextBox("NewNoteText",null, new { spellcheck = "true"})</span> <span class="editor-label">High Priority:</span> <span class="editor-field">@Html.CheckBox("HighPriority")</span> <input type="submit" value="Add" /></p> </div>}The only issue is when i try to add a command. Changing the grid code to :
Html.Telerik().Grid<DGI.CoBRA.Web.BusinessObjects.FullLogEntry>(Model).Name("loggrid").DataKeys(keys =>{ keys.Add(p => p.LogEntryGUID).RouteKey("LogEntryGUID");}).Columns(columns =>{ columns.Bound(o => o.FriendlyUserName ).Width(120).Title("User"); columns.Bound(o => o.EventDescription).Template(@<text> @if (item.Priority == DGI.CoBRAPlugInSDK.LogPriority.High) { <span style="color: #FF0000">@item.EventDescription</span> } else { <span>@item.EventDescription</span> } </text> ) .ClientTemplate("<# if (Priority==30) {#>" + "<span style='color: #FF0000'><#=EventDescription#></span>" + " <#} else {#>" + "<span><#=EventDescription#></span>" + " <#}#>"); columns.Bound(o => o.FormattedDateCreated).Width(120).Title("Date Created"); columns.Command(c => { c.Delete().ButtonType(GridButtonType.ImageAndText); }).IncludeInContextMenu(false).Width(35);}).DataBinding(dataBinding =>{ dataBinding.Ajax().OperationMode(GridOperationMode.Client) .Update("_UpdateLogEntry", "Notes", new { area = "Tools", id = @Model.ProjectGUID }) .Delete("_DeleteLogEntry", "Notes", new { area = "Tools", id = @Model.ProjectGUID }) .Select("_GetLogList", "Notes", new { area = "Tools", id = @Model.ProjectGUID });} ) .ClientEvents(events => events.OnRowDataBound("onRowDataBound")).Scrollable(scrolling => scrolling.Enabled(false)).Sortable(sorting => sorting.Enabled(true))//.OrderBy(order =>order.Add(o => o.DateCreated))).Pageable(paging => paging.Enabled(true)).Filterable(filtering => filtering.Enabled(true)).Groupable(grouping => grouping.Enabled(false)).Footer(true).Render();c.validator.methods[e] is undefined
Now, if i use a custom command it doesn't break anything, but I don't like that solution because it doesn't help me when i try for 'Edit' (which breaks my ajax beginform as well).
Why is the grid breaking my ajax.beginform?