【问题标题】:Unable to cast the object type "System.Web.Mvc.HtmlHelper` 1 [System.Object] "to type" System.Web.Mvc.HtmlHelper "无法将对象类型“System.Web.Mvc.HtmlHelper` 1 [System.Object]”转换为“System.Web.Mvc.HtmlHelper”
【发布时间】:2014-01-29 08:00:58
【问题描述】:

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

【问题讨论】:

标签: c# asp.net-mvc devexpress devexpress-mvc


【解决方案1】:

链接的 Ty,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>

【讨论】:

    猜你喜欢
    • 2021-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-21
    相关资源
    最近更新 更多