Hi
I need some help creating this extenstion method.
My View page enherits from
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/NoSideMenu.Master"
Inherits="System.Web.Mvc.ViewPage<List<MyProject.Models.Customer>>" %>
<% Html.Telerik().Grid(Model)
.Name("customer-history-grid").Footer(false).Columns(columns =>
{
columns.Bound(o => o.IsValidCustomer).Title(Html.Resource("ValidCustomerTableHeader"));
}
).Pageable(pager => pager.PageSize(25))
.Footer(true)
.Render();
%>
Here I don't want to display the boolean value. Instead I want to display "Y" or "N". For example if o.IsValidCustomer is true then "Y" else "F"
I tried writing below
Extensions...
public static string ConvertToString<T, TValue>(this HtmlHelper<T> helper, Expression<Func<T, TValue>> expression)
{
......
}
But my extenstion method picks up the > type and not the Customer object. So I cannot select the method (o.IsValidCustomer) in the lamda expression for example
in View...
columns.Bound(o => o.IsValidCustomer).Format(Html.ConvertToString(o => o.IsValidCustomer)).Title(Html.Resource("ValidCustomerTableHeader"));
Please help.