Hi Guys recently i have been battling with adding a kendo grid with upload on a toolbar within a kendo ui window. I have a command button on the main grid which when clicked it shows the window that has a grid inside. Please see below the code,
colums.Command(cmd => { cmd.Edit(); cmd.Custom("Upload images").Click("UploadImages"); //cmd.Custom("Upload images").SendDataKeys(true).Click("Upload images"); }).Title("Actions");I have this code on the main grid, when clicked it shows the pop windowand the code for the window,
@{Html.Kendo().Window().Name("AuditPic") .Title("AuditPictureResult Image") .Visible(false) .Modal(true) .Draggable(true) .Width(800).Height(800) .Content((Html.Kendo().Grid<KendoUIApp1_Test.Models.AuditPicIncidentModel>() .Name("Audit") .Columns(columns => { columns.Bound(b => b.AuditResultPictureID); columns.Bound(b => b.FileName).Title("File Name").ClientTemplate("<img src ='" + Url.Content("~/Images/") + "\\#=FileName\\#' height='62' width='62'/>"); columns.Bound(b => b.PictureCaption).Title("Picture Caption").HtmlAttributes(new { style = "overflow: hidden; text-overflow: ellipsis;white-space:nowrap;" }).EditorTemplateName("ConfigurationSettingItemEditor"); columns.Bound(b => b.ReplID); columns.Command(command => command.Destroy()).Width(100); }) .Pageable() .Sortable() .Scrollable() .Filterable() .Selectable() .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(m => m.AuditResultPictureID); }) .Read(read => read.Action("ConfigurationItem_Read", "Home", new { SiteAuditID = "#=SiteAuditID#", QuestionID = "#=QuestionID#" })) .Destroy(update => update.Action("FilesDestroy", "Home")) )).ToHtmlString()).Render(); }the function for the pop up and reading the data but it doesnt show any data on the grid function UploadImages(e) { e.preventDefault(); var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var wnd = $("#AuditPic").data("kendoWindow"); @* wnd.refresh({ url: '@Url.Action("ConfigurationItem_Read","Home")', data: { SiteAuditID: dataItem.SiteAuditID, QuestionID: dataItem.QuestionID } });*@ // wnd.content(detailstemplate(dataItem)); wnd.center().open(); $.ajax({ type: "POST", data: { SiteAuditID: JSON.parse(dataItem.SiteAuditID), QuestionID: JSON.parse(dataItem.QuestionID) }, //gets the value of the field "Department" url: '@Url.Action("ConfigurationItem_Read","Home")', success: function (result) { // console.log(result); // var DepartmentID = JSON.parse(model.DepartmentID); //arg.model.set("field name as string", "value as appropriate data type"); //alert("success:" + DepartmentID); } }) }