问题描述
- System.Web.Mvc.HtmlHelper`1[System.Object]转换为System.Web.Mvc.HtmlHelper
-
无法将System.Web.Mvc.HtmlHelper`1[System.Object] 的对象强制转换为类型 System.Web.Mvc.HtmlHelperASP.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()
时间: 2024-11-02 06:41:08