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

时间:2021-05-23 16:53:45

I'm using DevExpress controlls in my mvc asp.net project. Here is code of View:

我在我的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>

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演示的示例代码。

1 个解决方案

#1


5  

Ty for link, Nitin Varpe. I added this section to my main web.config:

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>

#1


5  

Ty for link, Nitin Varpe. I added this section to my main web.config:

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>