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

我在我的mvc asp.net项目中使用DevExpress控件.这是代码
<div>
    @Html.DevExpress().TextBox(settings =>
    {
        settings.Name = "TextBox";
        settings.Width = 170;
        settings.Properties.displayFormatString = "[ 00 - 00 - 00 ]";
        settings.Text = "123456";
    }).GetHtml()
</div>

这是错误信息:

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

我无法理解我的代码失败的地方,因为它是来自DevExpress演示的示例代码.

解决方法

Ty for link,Nitin Varpe.我将此部分添加到我的主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>

相关文章

C#项目进行IIS部署过程中报错及其一般解决方案_c#iis执行语句...
微信扫码登录PC端网站应用的案例(C#)_c# 微信扫码登录
原文地址:http://msdn.microsoft.com/en-us/magazine/cc163...
前言 随着近些年微服务的流行,有越来越多的开发者和团队所采...
最近因为比较忙,好久没有写博客了,这篇主要给大家分享一下...
在多核CPU在今天和不久的将来,计算机将拥有更多的内核,Mic...