简体   繁体   English

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

[英]Unable to cast the object type “System.Web.Mvc.HtmlHelper` 1 [System.Object] ”to type“ System.Web.Mvc.HtmlHelper ”

I'm using DevExpress controlls in my mvc asp.net project.我在我的 mvc asp.net 项目中使用 DevExpress 控件。 Here is code of View:这是视图的代码:

<div>
    @Html.DevExpress().TextBox(settings =>
    {
        settings.Name = "TextBox";
        settings.Width = 170;
        settings.Properties.DisplayFormatString = "[ 00 - 00 - 00 ]";
        settings.Text = "123456";
    }).GetHtml()
</div>

and here is error message:这是错误消息:

 Unable to cast the object type "System.Web.Mvc.HtmlHelper` 1 [System.Object]" to
 type "System.Web.Mvc.HtmlHelper"

I cant understand where my code is failing, because it's sample code from DevExpress demos.我无法理解我的代码在哪里失败,因为它是来自 DevExpress 演示的示例代码。

Ty for link, Nitin Varpe. Ty 链接,Nitin Varpe。 I added this section to my main web.config:我将此部分添加到我的主 web.config 中:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
</assemblyBinding>
</runtime>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “System.Web.Mvc.HtmlHelper”没有名为“Partial”的适用方法 - 'System.Web.Mvc.HtmlHelper' has no applicable method named 'Partial' System.Web.Mvc.HtmlHelper不包含MvcSiteMap的定义 - System.Web.Mvc.HtmlHelper does not contain a definition for MvcSiteMap 系统.Web.Mvc.HtmlHelper<ModelName> 不包含定义 - System.Web.Mvc.HtmlHelper<ModelName> does not contain a definition for System.Web.Mvc.HtmlHelper不包含“ DropDownListFor”的定义 - System.Web.Mvc.HtmlHelper does not contain a definition for 'DropDownListFor' &#39;System.Web.Mvc.HtmlHelper&#39;没有适用的名为&#39;TextBox&#39;的方法 - 'System.Web.Mvc.HtmlHelper' has no applicable method named 'TextBox' 剃刀视图看不到System.Web.Mvc.HtmlHelper - Razor Views not seeing System.Web.Mvc.HtmlHelper System.Web.Mvc.HtmlHelper&#39;不包含CheckBox的定义 - System.Web.Mvc.HtmlHelper' does not contain a definition for CheckBox “System.Web.Mvc.HtmlHelper”不包含“RenderPartial”的定义 - ASP.Net MVC - 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' - ASP.Net MVC CS1928:“ System.Web.Mvc.HtmlHelper”不包含“ DropDownListFor”的定义 - CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'DropDownListFor' 无法将类型'System.Nullable`1'强制转换为'System.Object'类型 - ASP.NET MVC - Unable to cast the type 'System.Nullable`1' to type 'System.Object' - ASP.NET MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM