inline editing redirects to another page

2 posts, 0 answers
  1. Tops Software
    Tops Software avatar
    8 posts
    Member since:
    Aug 2012

    Posted 20 Dec 2013 Link to this post

    Hi, I'm having an issue with inline editing, create with the kendo grid. 
    When I click on the "edit" button in the grid, instead of the row turning into edit mode, I am redirected to a bank view with Json data. The same thing happens when I click on the "create" button in the grid. If it helps to know, this view is actually a partial view that is injected via ajax and It displays fine..

    I have tried a lot of different things, like checking that I have the required JS libraries, tweaking the grid configurations in my view, etc... 
    I'm sure there is something really small that is causing this behavior and I would appreciate it if anybody can help me with this..

    The view:
    @model IEnumerable<TOPS.IQ.ViewModels.Administration.WebInfoVM>
     
        @(Html.Kendo().Grid<TOPS.IQ.ViewModels.Administration.WebInfoVM>(Model)
                    .Name("grid")
                    .HtmlAttributes(new { style = "height: 280px;" })
                    .DataSource(dataSource =>
                        dataSource.Ajax()
                                .Read(read => read.Action("EditingInlineWebInfo_Read", "Administration", new { id = Model.FirstOrDefault() == null ? 0 : Model.First().CommunityID }))
                                .Model(model => model.Id(m => m.WebInfoID))
                                .Create(update => update.Action("EditingInlineWebInfo_Create", "Administration"))
                                .Update(update => update.Action("EditingInlineWebInfo_Update", "Administration"))
                                .Destroy(update => update.Action("EditingInlineWebInfo_Destroy", "Administration"))
                                 
                        )
                    .Columns(columns =>
                    {
                        columns.Bound(p => p.WebInfoTypeName);
                        columns.Bound(p => p.Email);
                        columns.Bound(p => p.Description);
                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
                    })
                     
                     
                    .ToolBar(toolbar => toolbar.Create())
                    .Editable()
                    .Pageable()
                    .Sortable()
                    .Scrollable()
                     
                     
     )

    The Controller actions:

    public JsonResult EditingInlineWebInfo_Read([DataSourceRequest] DataSourceRequest request, int id)
           {
               //get the web infos for the given community
               var webInfos = _service.FindAll<Community_Webaddress>().Where(c => c.CommunityID == id).Select(c => c.WebAddress);
               var webInfosVM = webInfos.ConvertToWebInfoesVM();
     
               return Json(webInfosVM.ToDataSourceResult(request),JsonRequestBehavior.AllowGet);
           }
     
           [HttpPost]
           public ActionResult EditingInlineWebInfo_Create([DataSourceRequest] DataSourceRequest request, WebInfoVM webVM)
           {
               if (webVM != null && ModelState.IsValid)
               {
                   var webAddr = webVM.ConvertToWebAddress();
                   _service.Add<WebAddress>(webAddr);
                   var task = _service.SaveChangesAsync();
                   int result = task.Result;
               }
     
               return Json(new[] { webVM }.ToDataSourceResult(request, ModelState));
           }
     
           [HttpPost]
           public ActionResult EditingInlineWebInfo_Update([DataSourceRequest] DataSourceRequest request, WebInfoVM webVM)
           {
               if (webVM != null && ModelState.IsValid)
               {
                   var webAddr = webVM.ConvertToWebAddress();
                  var task = _service.SaveChangesAsync();
                  int result = task.Result;
               }
     
               return Json(new[] { webVM }.ToDataSourceResult(request, ModelState));
     
           }

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 21 Dec 2013 Link to this post

    Hi Kevin,

    I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

    Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top