I am using NonFactors Grid.Mvc (http://mvc-grid.azurewebsites.net/) and I found limitation in this Grid, if you see an example on http://mvc-grid.azurewebsites.net/Grid/SourceUrl
Code in above Example is(bold line contains the limitation that unable to pass lambda expression):
@model IEnumerable<Person>
@(Html
.Grid(Model)
.Build(columns =>
{
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("Age");
columns.Add(model => model.Birthday).Titled("Birth date").Formatted("{0:d}");
columns.Add(model => model.IsWorking).Titled("Employed");
})
.WithSourceUrl(Url.Action("SourceUrl", "Grid"))
.Empty("No data found")
.Pageable(pager =>
{
pager.PagesToDisplay = 3;
pager.RowsPerPage = 2;
})
.Filterable()
.Sortable()
)
I want replace the .WithSourceUrl(Url.Action("SourceUrl", "Grid"))
with .WithSourceUrl(Url.Action("SourceUrl", "Grid", new {m => m.personId}))
and I did research to create the method like this
public MvcHtmlString WithSourceUrlFor<TValue>(Expression<Func<T, TValue>> expression)
{
var MvcHtmlString = ExpressionHelper.GetExpressionText(expression);
return MvcHtmlString;
}
but I was unable to convert lamda expression into MvcHtmlString and I am stuck.
Please help me.
Thanks