簡體   English   中英

Crystal Reports不顯示有關MVC3 ActionResult的報告

[英]Crystal Reports not showing report on MVC3 ActionResult

標題不是最好的描述錯誤的方法。 我將嘗試描述正在發生的事情。

首先,我的場景是:我正在使用“ SAP Crystal Reports para Visual Studio 2010”。 這是代碼的一部分:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Save(FacturaHeaderModel model, FormCollection formCollection)
{
...
var reporte = model.Movimiento.DescripLarga.ToLowerInvariant().Contains("compra")
                              ? System.Web.HttpContext.Current.Request.PhysicalApplicationPath + @"rpt\fact_compra.rpt"
                              : System.Web.HttpContext.Current.Request.PhysicalApplicationPath + @"rpt\fact_venta.rpt";
var rptH = new ReportClass { FileName = reporte };
rptH.Load();
rptH.RecordSelectionFormula = "{CtaCteCliente.CtaCteClienteId}=" + facturaId;              
var cnn = new ReportHelper(); //internal function to connect to the database all the sub reports in the report to show
cnn.Connect(rptH);
try
 {
  var stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat);
  return File(stream, "application/pdf");
 }
 catch
 {
  return "Error";
 }
}

由於某種原因無法正常工作且未顯示任何結果。 在系統的其他部分,被調用以使用相似的代碼進行報告,並且一切正常。

我可以在此處添加其他信息以正確診斷問題。

編輯:02/09/2013

這是我觀點的一部分:

@using (Html.BeginForm("Guardar", "Facturas", FormMethod.Post))
{
<fieldset>
    <div class="editor-label" style="font-size:16px;">
        @Html.LabelFor(m => m.Movimiento.DescripLarga)
        <div class="editor-field">
            @Html.TextBoxFor(m => m.Movimiento.DescripLarga, new { @readonly = "readonly", style = "font-weight: bold;font-size:16px;" })
        </div>
    </div>
....
<input type="submit" name="Guardar" id="guardar" title="Guardar" value="Guardar" />
......
}

這是請求和響應的一部分:

 Encabezados de respuesta
 Cache-Control  private
 Connection Close
 Content-Length 42138
 Content-Type   application/pdf
 Date   Mon, 02 Sep 2013 21:30:53 GMT
 Server ASP.NET Development Server/10.0.0.0
 X-AspNet-Version   4.0.30319
 X-AspNetMvc-Version    3.0

 Encabezados de solicitud
 Accept */*
 Accept-Encoding    gzip, deflate
 Accept-Language    es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
 Content-Length 340
 Content-Type   application/x-www-form-urlencoded; charset=UTF-8
 Host   xxxxx
 Referer    http://xxxxx/Facturas/Compras
 User-Agent Mozilla/5.0 (Windows NT 6.1; rv:23.0) Gecko/20100101 Firefox/23.0
 X-Requested-With   XMLHttpRequest

我在想象錯誤實際上是通過客戶端正在發送的服務器上等待的響應而發生的。 但是應該解決嗎?

嘗試后,表格的正確標題為:

@using (Html.BeginForm("Guardar", "Facturas", FormMethod.Post, new { enctype = "multipart/form-data" }))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM