MVC, Razr
I've got a model Event. Event has children Participants.
On the detail page for Event I am trying to display a list of participants for the currently viewed event and give the user the option to select participants.
I can't figure out how to display the participants for the currently selected Event using JSON bound grid. I did manage to get this working with the events on the index page (selectable events, checkboxes etc), but I can't figure out how to create a JSON request to the controller for the participants for the currently selected Event.
I did have better luck with binding to the view model (below), but I can't get my checkboxes to display (first column) and even if I get them displaying, I'm not really sure I want to loop through the rows with jscript and process each checked row.
Thanks in advance
michael
<code>
====== Controller ========
public ActionResult Details(int id = 0)
{
Event evt= db.EventFind(id);
if (deform == null)
{
return HttpNotFound();
}
return View(evt);
}
====== View ========
@model Application.Models.Event
...
@(Html.Kendo().Grid(Model.Participants).Name("participantsGrid")
.Columns(c =>
{
c.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= ApprovedFlag ? checked='checked':'' # class='chkbx' />")
.HeaderTemplate("<p>Org Approved</p>");
c.Bound(p => p.FullName).ClientTemplate(@Html.ActionLink("#=FullName#", "Details", new { Id = "#=ParticipantId#" }).ToHtmlString());
c.Bound(p => p.ParticipantId);
c.Bound(p => p.OrgApprovedFlag);
})
.DataSource(ds => ds
.Server()
.Model(model =>
{
model.Id(p => p.ParticipantId);
})
.Read(read => read.Action("GetParticipants", "Event"))
)
)
</code>
I've got a model Event. Event has children Participants.
On the detail page for Event I am trying to display a list of participants for the currently viewed event and give the user the option to select participants.
I can't figure out how to display the participants for the currently selected Event using JSON bound grid. I did manage to get this working with the events on the index page (selectable events, checkboxes etc), but I can't figure out how to create a JSON request to the controller for the participants for the currently selected Event.
I did have better luck with binding to the view model (below), but I can't get my checkboxes to display (first column) and even if I get them displaying, I'm not really sure I want to loop through the rows with jscript and process each checked row.
Thanks in advance
michael
<code>
====== Controller ========
public ActionResult Details(int id = 0)
{
Event evt= db.EventFind(id);
if (deform == null)
{
return HttpNotFound();
}
return View(evt);
}
====== View ========
@model Application.Models.Event
...
@(Html.Kendo().Grid(Model.Participants).Name("participantsGrid")
.Columns(c =>
{
c.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= ApprovedFlag ? checked='checked':'' # class='chkbx' />")
.HeaderTemplate("<p>Org Approved</p>");
c.Bound(p => p.FullName).ClientTemplate(@Html.ActionLink("#=FullName#", "Details", new { Id = "#=ParticipantId#" }).ToHtmlString());
c.Bound(p => p.ParticipantId);
c.Bound(p => p.OrgApprovedFlag);
})
.DataSource(ds => ds
.Server()
.Model(model =>
{
model.Id(p => p.ParticipantId);
})
.Read(read => read.Action("GetParticipants", "Event"))
)
)
</code>