Skip to content

Instantly share code, notes, and snippets.

@andiih
Created October 25, 2018 14:13
Show Gist options
  • Select an option

  • Save andiih/5a627d694b921b4bf3bb46e0a7ba19e3 to your computer and use it in GitHub Desktop.

Select an option

Save andiih/5a627d694b921b4bf3bb46e0a7ba19e3 to your computer and use it in GitHub Desktop.
A view ready for the MVC controller and StandardGridBuilder
@using System.Collections
@using FiftyEggs.Data.Models
@using Kendo.Mvc.UI
@{
var cn = (string)ViewBag.ControllerName;
var builder = new StandardGrid<Job>(cn, Url);
}
<h2>@cn</h2>
@(builder.Build(Html.Kendo().Grid<Job>(),
m =>
{
m.Id(p => p.Id);
m.Field(f => f.CustomerId).DefaultValue(1);
m.Field(f => f.MaterialStatusId).DefaultValue(1);
}).Columns(
cols =>
{
cols.Bound(c => c.Id);
cols.ForeignKey(c => c.CustomerId, (IEnumerable)ViewData["customers"], "Id", "Desc").Title("Customer").Width(75);
cols.Bound(c => c.PartNoDesc);
cols.ForeignKey(c => c.MaterialStatusId, (IEnumerable)ViewData["matstats"], "Id", "Status").Title("Material Status");
cols.Command(c => c.Destroy());
}
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment