2 gong xiao pan gong_xiao_pan 于 2013.11.19 21:47 提问

System.Web.Mvc.HtmlHelper`1[System.Object]转换为System.Web.Mvc.HtmlHelper

无法将System.Web.Mvc.HtmlHelper`1[System.Object] 的对象强制转换为类型 System.Web.Mvc.HtmlHelper

ASP.NET MVC4 下使用DevExpress 开发的第三方控件出错

代码:
@{
var grid = Html.DevExpress().GridView(settings =>
{
settings.Name = "GridViewCustomer";
settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartialCustomers" };

    settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Home", Action = "GridViewPartialCustomersAddNew" };
    settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Home", Action = "GridViewPartialCustomersUpdate" };
    settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Home", Action = "GridViewPartialCustomersDelete" };
    settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
    settings.SettingsBehavior.ConfirmDelete = true;

    settings.CommandColumn.Visible = true;
    settings.CommandColumn.NewButton.Visible = true;
    settings.CommandColumn.DeleteButton.Visible = true;
    settings.CommandColumn.EditButton.Visible = true;

    settings.KeyFieldName = "CustomerID";

    settings.SettingsPager.Visible = true;
    settings.Settings.ShowGroupPanel = true;
    settings.Settings.ShowFilterRow = true;
    settings.SettingsBehavior.AllowSelectByRowClick = true;

    settings.Columns.Add("CustomerID");
    settings.Columns.Add("CustomerName");
    settings.Columns.Add("ContactName");
    settings.Columns.Add("Address");
    settings.Columns.Add("PostalCode");
    settings.Columns.Add("Tel");
});
if (ViewData["EditError"] != null)
{
    grid.SetEditErrorText((string)ViewData["EditError"]);
}

}
@grid.Bind(Model).GetHtml()

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!