Name | Surname | Marital status | Encoded age | Not encoded age | Birthday | Employed | ||
---|---|---|---|---|---|---|---|---|
Joe | Crosswave | Married | <span>32</span> | 32 | 1/5/1993 | False | ||
Merry | Lisel | Widowed | <span>41</span> | 41 | 5/6/1983 | |||
Henry | Crux | Single | <span>29</span> | 29 | 11/19/1995 | True | ||
Cody | Jurut | <span>49</span> | 49 | 8/11/1975 | False | |||
Simon | Scranton | Single | <span>34</span> | 34 | 10/10/1990 | |||
Leena | Laurent | Divorced | <span>19</span> | 19 | 7/1/2005 | False | ||
Ode | Cosmides | Married | <span>53</span> | 53 | 4/17/1971 | True | ||
Diandra | Mizner | Single | <span>20</span> | 20 | 8/20/2004 | False | ||
Pete | Cassel | Married | <span>22</span> | 22 | 3/13/2002 | False | ||
Nicky | Tremblay | Married | <span>32</span> | 32 | 1/5/1993 | True | ||
Mary | Cassel | Married | <span>24</span> | 24 | 7/10/2000 | True |
@model IQueryable<Person>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(model => Html.CheckBox("Person_" + model.Id)); // IHtmlContent has encoding disabled by default.
columns.Add(model => $"<button data-id=\"{model.Id}\">Edit</button>").Encoded(false);
columns.Add(model => model.Name).Titled("Name");
columns.Add(model => model.Surname).Titled("Surname");
columns.Add(model => model.MaritalStatus).Titled("Marital status");
columns.Add(model => model.Age).Titled("Encoded age").RenderedAs(model => "<span>" + model.Age + "</span>");
columns.Add(model => model.Age).Titled("Not encoded age").RenderedAs(model => "<span style='color: #CC4444'>" + model.Age + "</span>").Encoded(false);
columns.Add(model => model.Birthday).Titled("Birthday").Formatted("{0:d}");
columns.Add(model => model.IsWorking).Titled("Employed");
})
)