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">
@(Html.Kendo().Grid<WebClaims.Common.Models.Property>(Model.OtherProperties)
.Name("OtherProperties")
.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
.Ajax()
.Model(m=>{
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=> {
create.Action("Create","OtherPropertiesGrid").Type(HttpVerbs.Post);
})
.Update(u =>{
u.Action("Update", "OtherPropertiesGrid");
})
.Destroy(u =>{
u.Action("Destroy", "OtherPropertiesGrid");
})
)
.ToolBar(t=>{
t.Create();
})
.Sortable()
.Scrollable()
)
</div>
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:
[AcceptVerbs(HttpVerbs.Post)]
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.
thanks
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">
@(Html.Kendo().Grid<WebClaims.Common.Models.Property>(Model.OtherProperties)
.Name("OtherProperties")
.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
.Ajax()
.Model(m=>{
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=> {
create.Action("Create","OtherPropertiesGrid").Type(HttpVerbs.Post);
})
.Update(u =>{
u.Action("Update", "OtherPropertiesGrid");
})
.Destroy(u =>{
u.Action("Destroy", "OtherPropertiesGrid");
})
)
.ToolBar(t=>{
t.Create();
})
.Sortable()
.Scrollable()
)
</div>
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:
[AcceptVerbs(HttpVerbs.Post)]
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.
thanks