Kendo Grid Create method issues/help

3 posts, 0 answers
  1. James
    James avatar
    2 posts
    Member since:
    Feb 2013

    Posted 20 Mar 2013 Link to this post

    EDIT:: Figured something out

    if I change :: 
     Create([DataSourceRequest] DataSourceRequest request, Property model)

    TO:: Create([DataSourceRequest] DataSourceRequest request, Property <ANY OTHER WORD BUT model> )

    it works.  _model, data, stuff

    Please any clues, and or answers would be great.

    I apologize if this has been covered elsewhere, I have looked and not found an answer.

    the issue is as follows:

    I have a kendo grid on a strongly typed view  see below:

    <div style="margin: 0 1em; width: 940px">
            .Columns(columns =>
                columns.Bound(p => p.Make).HeaderTemplate("Vehicle").HeaderHtmlAttributes(new { style = "width:30%;" });
                columns.Bound(p => p.Model).HeaderHtmlAttributes(new { style = "display:none;" });
                columns.Bound(p => p.Year).HeaderHtmlAttributes(new { style = "display:none;" });
                columns.Bound(p => p.Driver.FirstName).HeaderHtmlAttributes(new { style = "display:none;" });
                columns.Bound(p => p.Driver.LastName).HeaderTemplate("Driver Info");
                columns.Command(cmd => cmd.Edit());

           .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("Property"))
            .DataSource(dataSource => dataSource
                    m.Id(p => p.ID);
                    m.Field(p => p.ID).DefaultValue(Guid.NewGuid());
                    m.Field(p => p.Make).DefaultValue("Unknown");
                    m.Field(p => p.Model).DefaultValue("Unknown");
                    m.Field(p => p.Year).DefaultValue(DateTime.Now.Year);
                    m.Field(p => p.Driver).DefaultValue(WebClaims.Common.Models.Claimant.Default());
                .Read(read =>{
                    read.Action("Read", "OtherPropertiesGrid");

                .Create(create=> {
                .Update(u =>{
                    u.Action("Update", "OtherPropertiesGrid");
                .Destroy(u =>{
                    u.Action("Destroy", "OtherPropertiesGrid");

    the Create will open the editor template and when the update button is pressed it fires the Create Action on the controller however, i must be doing something wrong as the model that is passed is null:

            public ActionResult Create([DataSourceRequest] DataSourceRequest request, Property model)
            {                                                                                                    this is populated^               this is NULL ^
                WebClaims.Common.Models.Claim c = Session["claim"] as WebClaims.Common.Models.Claim;
                 //DO stuff //
                return Json(c.OtherProperties.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);


    something else thats a bit off is that the edit command fires the create action not the update?? 

    If I populate the list of stuff I want to see before hand the read call works, 

    I'm not sure what I'm doing wrong... any and all help would be great.


  2. Vladimir Iliev
    Vladimir Iliev avatar
    2194 posts

    Posted 22 Mar 2013 Link to this post

    Hi Jimm,

    After reviewing the provided information it seems that the issue comes from that the current model contains property "Model" and the MVC model binder tries to bind it to the "model" variable that the action expects. In current case I would suggest to use different name for the accepted model in the controller action.

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. James
    James avatar
    2 posts
    Member since:
    Feb 2013

    Posted 22 Mar 2013 Link to this post

    Thanks, Vladimir you were indeed correct.  Looks as though this is an undocumented feature of MVC, dont know how long it would have taken us to find that out.

    Again,  Thanks
Back to Top