我正在尝试为kendogrid创建一个自定义的HtmlHelper,以便与参数一起使用。
我的问题是如何重构我的视图模型来接受接口htmlhelper?
这是我的htmlhelper类
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")));
}
}
}`
和我的viewmodel类
public class TextViewModel
{
public int Id { get; set; }
public string Text { get; set; }
}
问题:C => c.Text
MSVS:无法将lambda表达式转换为类型“string”,因为它不是委托类型
发布于 2016-03-03 14:03:20
.Columns(columns =>
{
columns.Bound(c => c).Title("Text");
})
https://stackoverflow.com/questions/35773064
复制相似问题