I need to do this using reflection:
@Html.Grid((IEnumerable<MyType>)list).Columns(columns =>
{
columns.Add(foo => foo.Title)
.Titled("Custom column title")
.SetWidth(110);
columns.Add(foo => foo.Description)
.Sortable(true);
}).WithPaging(20)
Now I have var g
which is object created after call @Html.Grid((IEnumerable<MyType>)Model)
using refletion:
var method = typeof(GridMvc.Html.GridExtensions).GetMethods()
.Where(mi => mi.Name == "Grid")
.ElementAt(0)
.MakeGenericMethod(new Type[] { t });
var g = method.Invoke(null, new object[] { Html, list });
So I need do something like:
g.Columns(columns =>
{
columns.Add(foo => foo.Title)
.Titled("Custom column title")
.SetWidth(110);
columns.Add(foo => foo.Description)
.Sortable(true);
}).WithPaging(20)
using reflection.
Can someone provide example code to do this?
Aucun commentaire:
Enregistrer un commentaire