本文介绍了在剃刀MVC3增加报告Devex preSS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的MVC 3 Web应用程序使用DevEx preSS报告这个应用程序是一个正常的MVC 3应用程序不是一个DevEx preSS MVC 3应用程序使用下面的教程将XtraReports的

I am trying to use DevExpress reports in my MVC 3 web application "This application is a normal MVC 3 application not a DevExpress MVC 3 application" using the following tutorial for adding XtraReports http://documentation.devexpress.com/#XtraReports/CustomDocument9974

问题每个我试图添加时间

The problem is each time i am trying to add

@Html.DevExpress().ReportToolbar(settings => {
// The following settings are necessary for a Report Toolbar. 
settings.Name = "ReportToolbar";
settings.ReportViewerName = "reportViewer1";
}).GetHtml()

DevEx $ P $(PSS)给我一个错误

DevExpress() gives me an error

System.Web.Mvc.HtmlHelper'不包含'DevEx preSS',没有扩展方法'DevEx preSS接受式的第一个参数的定义System.Web.Mvc.HtmlHelper '可以找到(是否缺少using指令或程序集引用?)

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'DevExpress' and no extension method 'DevExpress' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

有什么建议?

推荐答案

您必须使用此链接手动注册Devex preSS组件到您的项目提供的步骤:

You must use the steps provided in this link to manually register Devexpress components to your project:

在上面提供的步骤,唯一缺少的是程序集绑定重定向。没有它,我得到异常:

The only thing missing in the steps provided above was the assembly binding redirect. Without it, I was getting the exception:

[InvalidCastException: Unable to cast object of type 'System.Web.Mvc.HtmlHelper`1[System.Object]' to type 'System.Web.Mvc.HtmlHelper'.]

要prevent错误,我添加了这部分我主要的web.config在<结构>

To prevent the error, I added this section to my main web.config under <configuration>:

<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>

这将重定向旧的组装MVC版本的MVC 4.对于MVC 3,bindingRedirect行应该是这样的:

This will redirect older mvc assembly versions to MVC 4. For MVC 3, the bindingRedirect line should be like this:

<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />

这篇关于在剃刀MVC3增加报告Devex preSS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:27