This is a migrated thread and some comments may be shown as answers.

inline editing redirects to another page

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tops Software
Top achievements
Rank 2
Tops Software asked on 20 Dec 2013, 03:25 PM
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));
 
       }

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 21 Dec 2013, 08:10 AM
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!
Tags
Grid
Asked by
Tops Software
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
Share this question
or