Error when including a webform file in a view for MVC C #

0

Along with saying hello, I wanted to ask for your great help: It turns out that I want to incorporate in a view, a partial one that is a webform:

I have a view called See:

public ActionResult Ver(){

return View();
}

in the cshtml I call the webform:

@Html.Partial("Mostrarejemplo")  

But in that same line of html.partial, I get the following error:

The view found in '~ / Views / Business Archives / PrintDos.aspx' must be derived from ViewPage, ViewPage, ViewUserControl or ViewUserControl.

And the webform file (Sample) is located on the same route from where I call the view.

I would like that if anyone knows, please help me, from now on, thanks.

Note: The objective of why I do this, is to be able to have the preview option of the pdf that is generated with reportviewer, in the same way as this example page indicates: link

since currently I do it like this:

    public FileContentResult GetFileContentResult(ReportParameter[] parametro, string nombreReporte, dynamic query, string nombreDataSource, String format, String deviceInfo, String fileDownloadName)
    {
        LocalReport report = new LocalReport();
        report.ReportPath = HttpContext.Current.Server.MapPath("~/Reportes/" + nombreReporte);

        report.DataSources.Clear();
        //report.ReportEmbeddedResource="dd.rdlc";
        ReportDataSource reportDataSource = new ReportDataSource();
        reportDataSource.Value = query;
        reportDataSource.Name = nombreDataSource;
        report.DataSources.Add(reportDataSource);
        report.SetParameters(parametro);
        report.Refresh();


        String mimeType;
        String encoding;
        String filenameExtension;
        String[] streamIds;
        Warning[] warnings;

        FileContentResult fileContentResult = new FileContentResult(report.Render(format, deviceInfo, out mimeType, out encoding, out filenameExtension, out streamIds, out warnings), mimeType);
        fileContentResult.FileDownloadName = Path.ChangeExtension(fileDownloadName, filenameExtension);

        return fileContentResult;
    }

but I only download the pdf, and it does not open to me as a preview. If it were possible, this solution would solve my objective. Either way or both, would be a great contribution.

    
asked by Danilo 18.05.2017 в 07:39
source

0 answers