I'm trying to create a custom HtmlHelper for kendogrid to use with parameters.
My problem is how to refact my viewmodel to accept an interface the htmlhelper?
here is my htmlhelper class
using System;
using System.Web.Mvc;
using Kendo.Mvc.UI;
using System.Linq;
using Popup.BLL.ViewModel;
namespace Popup.Web.KendoHelper
{
public static class PickListHelper
{
public static Kendo.Mvc.UI.Fluent.GridBuilder<T> PickList<T>(this HtmlHelper helper, string gridName, string gridClass, int gridHeight)
where T : class
{
return helper.Kendo().Grid<T>()
.Name(gridName)
.Columns(columns =>
{
columns.Bound(c => c.Text).Title("Associated");
})
.HtmlAttributes(new { @class = gridClass, style = "height: " + gridHeight + "px;" })
.Scrollable()
.Sortable()
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Multiple))
.Events(events => events.Change("onSelectAssociatedGridElements"))
.DataSource(datasource => datasource.Ajax().Read(read => read.Data("getAssociatedGridDataSource")));
}
}
}`
and my viewmodel class
public class TextViewModel
{
public int Id { get; set; }
public string Text { get; set; }
}
problem: c => c.Text
MSVS: Cannot convert lambda expression to type 'string' because it is not a delegate type