or
@(Html.Kendo().Grid<
LedgerEntryViewModel
>()
.Name("grdItems2")
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("GeneralLedgerEntries", "GL").Data("gridBindingData"))
.PageSize(10)
)
.Columns(col =>
{
col.Bound(c => c.AccountingEventName).Title("Accounting Event").HtmlAttributes(new {style = "white-space:nowrap;width:50%;"});
})
.Sortable()
.Pageable()
)
public ActionResult GetEntries(string accountType, int? categoryID, int? accountID, int? year, int? month,
[DataSourceRequest]DataSourceRequest request)
{
var list = new List<
LedgerEntryViewModel
>();
list = _gridHelpers.GetAccountEntriesWithRunningTotal(accountType, accountID.Value);
DataSourceResult result = list.ToDataSourceResult(request);
var json = Json(list, JsonRequestBehavior.AllowGet);
return json;
}
.Columns(columns => {
columns.Bound(customer => customer.CustomerName).Title("Customer Name");
columns.Bound(customer => customer.CustomerStatus.CustomerStatusName).Title("Status");
})
ViewBag.Weighbridges = dbDataService.ToLookUp<
Weighbridge
>();
public class LookupEntity : ILookupEntity
{
public int Id { get; set; }
public string Description { get; set; }
}
@(Html.Kendo().MultiSelectFor(model => model.Weighbridges)
.Name("Weighbridges")
.DataTextField("Description")
.DataValueField("Id")
.Value(Model.Weighbridges)
.Placeholder("Select weighbridges...")
.HtmlAttributes(new {style= "width:310px"})
.AutoBind(true)
.BindTo((IEnumerable<
LookupEntity
>)ViewBag.Weighbridges)
)
[DisplayName("Assigned Weighbridges")]
public IEnumerable<
LookupEntity
> Weighbridges { get; set; }
@{
ViewBag.Title =
"Bills: Parent/Child"
;
}
<h2>Bills Index</h2>
@(Html.Kendo().Grid<BillParent>()
.Name(
"BillParentsGrid"
)
.Columns(columns =>
{
columns.Bound(h => h.Category);
columns.Bound(h => h.Description);
columns.Bound(h => h.Amount);
columns.Command(command =>
{
command.Edit();
}).Width(95);
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(h => h.BillId);
model.Field(h => h.BillId).Editable(
false
);
})
.Events(events => events.Error(
"error_handler"
))
.Read(read => read.Action(
"BillParents_Read"
,
"Bill"
))
.Update(update => update.Action(
"BillParent_Update"
,
"Bill"
))
)
.Events(events => events.DataBound(
"dataBound"
))
.ClientDetailTemplateId(
"BillChildren"
)
)
<script id=
"BillChildren"
type=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<BillChild>()
.Name(
"BillChildren_#=BillId#"
)
.Columns(columns =>
{
columns.Bound(d => d.BillId).Width(50);
columns.Bound(d => d.Description).Width(150);
columns.Bound(d => d.Amount).Width(80);
columns.Command(command =>
{
command.Edit();
command.Destroy();
}).Width(55);
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(d => d.BillId);
model.Field(d => d.BillId).Editable(
false
);
})
.Events(events => events.Error(
"error_handler"
))
.Read(read => read.Action(
"BillChildren_Read"
,
"Bill"
,
new
{ id =
"#=BillId#"
}))
.Update(update => update.Action(
"BillChild_Update"
,
"Bill"
))
.Create(create => create.Action(
"BillChild_Create"
,
"Bill"
,
new
{ id =
"#=BillId#"
}))
.Destroy(destroy => destroy.Action(
"BillChild_Destroy"
,
"Bill"
)))
.ToolBar(tools => tools.Create())
.ToClientTemplate()
)
</script>