简体   繁体   中英

ReportViewer control of devexpress in visual studio that does not recognize the LocalReport property

My question is about the ReportViewer control of devexpress 12 in visual studio 2012 that does not recognize the LocalReport property, I am using Visual Studio 2012 and Devexpress. using Microsoft.Reporting.WebForms, and it gives me error

        ReportParameter[] parameters = new ReportParameter[2];
        parameters[0] = new ReportParameter("tipo_empresa", ASPxComboBox_Tipo_Empresa.Text);
        parameters[1] = new ReportParameter("empresa", ASPxComboBox_Empresa.Text);
       // RepViewerAccident.LocalReport.SetParameters(parameters);

Error logs:

DevExpress.XtraReports.Web.ReportViewer 'does not contain a definition of' LocalReport 'nor was any extension method' LocalReport 'that accepts a first argument of type' DevExpress.XtraReports.Web.ReportViewer 'found (missing a usage directive or an assembly reference?)

I suggest you go through Use Report Parameters documentation and you can Request and Pass Report Parameter Values

using DevExpress.XtraReports.Web;
//... 
protected void Page_Load(object sender, EventArgs e) {
    XtraReport1 report = new XtraReport1();
    report.Parameters["parameter1"].Value = Convert.ToInt32(Request.QueryString["parameter1"]);
    ASPxWebDocumentViewer1.OpenReport(new CachedReportSourceWeb(report));
}

You can also create your custom report parameters - Create Custom Report Parameters

using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.UI;
// ... 

public enum Gender { Male, Female }

// Create a report instance. 
XtraReport report = new XtraReport();

// Create a new parameter. 
Parameter param = new Parameter();

// Specify required properties. 
param.Name = "GenderParameter";
param.Type = typeof(Gender);
param.Visible = true;

//Add the parameter to the report. 
report.Parameters.Add(param);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM