I am using the Mvccontrib ASP.NET MVC 3 grid like this:
@Html.Grid(Model).Columns(column => { column.For(x => x.UserId).Named("ID"); column.For(x => x.Name); column.Custom(@<div><img src='@item.ImageUrl' alt="@item.Name"/><a href="@item.Link">@item.Name</a></div>).Named("Name"); column.For(x => x.Score).Named("Score"); })
But now I need to move this to a custom mesh model:
@Html.MvcContrib().Grid(Model).WithModel(new MyGridModel()).Sort(ViewData["sort"] as GridSortOptions).Attributes(id => "grid", style => "width: 100%;")
with the appropriate grid:
public class MyGridModel : GridModel<MyModel> { public MyGridModel() { Column.For(x => x.UserId); Column.For(x => x.Name); Column.For(x => x.ImageUrl); RenderUsing(new HtmlTableGridRenderer<MyModel>()); } }
But how can I make my own column in my grid model?
Column.Custom (???);
source share