@(Html.Kendo().Grid()
.Name("gridParticipantAddress")
.NoRecords("No Addresses")
.Mobile()
.Events(ev => ev.DataBound("gridParticipantAddressDataBound").Save("griAddressOnGridEdit"))
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ParticipantAddressEditor").Window(w => w.Title("Address").Width(650)).DisplayDeleteConfirmation(false))
.ToolBar(toolbar =>
{
toolbar.Create().Text("New Address");
})
.Columns(columns =>
{
columns.Template(@).HtmlAttributes(new { @class = "templateCell" }).ClientTemplate(
(
Html.Kendo().DropDownButton()
.Name("DropDownButton_#=AddressID#")
.Popup(p=>p.AppendTo(".commandAnchor"))
.Icon("more-vertical")
.Items(items =>
{
items.Add().Id("edit_#=AddressID#").Text("Edit").Icon("edit").HtmlAttributes(new { data_title = "Edit Address", data_url = Url.Action("Edit", "ParticipantAddress", new { participantAddressID = "#=AddressID#" }) }).Click("editAddress");
items.Add().Id("delete_#=AddressID#").Text("Delete").Icon("trash").HtmlAttributes(new { data_title = "Delete Address", data_addressID = "#=AddressID#", data_url = Url.Action("Delete", "ParticipantAddress", new { participantAddressID = "#=AddressID#" }) }).Click("launchAddressDeleteDialog");
})
).ToClientTemplate().ToHtmlString())
;
columns.Bound(p => p.Current)
.ClientTemplate(
"# if (Current ==1) { #" +
"" +
"#} else {#" +
"" +
"#}#"
).Width(80)
.Filterable(false)
.HtmlAttributes(new { style = "text-align: center;" });
columns.Bound(e => e.AddressType).Width(120);
columns.Bound(e => e.Address1).Width(120);
columns.Bound(e => e.Address2).Width(120);
columns.Bound(e => e.CountyDesc).Width(120);
columns.Bound(e => e.State).Width(120);
columns.Bound(e => e.Zip).Width(120);
columns.Bound(e => e.CreateDate).Width(120).Format("{0:MM/dd/yyyy hh:mm}");
columns.Bound(e => e.CreateEmployee).Width(120);
columns.Bound(e => e.ModifyDate).Width(120).Format("{0:MM/dd/yyyy hh:mm}");
columns.Bound(e => e.ModifyEmployee).Width(120);
})
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Model(model =>
{
model.Id(product => product.AddressID);
model.Field(product => product.AddressID).Editable(false);
model.Field(product => product.ParticipantMemberCode).Editable(false).DefaultValue(Model);
})
.Read(read => read.Action("ParticipantAddresses_Datasource", "ParticipantAddress", new { participantMemberCode = Model }))
.Create(create => create.Action("Create", "ParticipantAddress"))
.Update(create => create.Action("Update", "ParticipantAddress"))
.Destroy(create => create.Action("Delete", "ParticipantAddress"))
.Events(events => events.Error("gridParticipantAddressOnError"))
)
)