2013-08-27 101 views
0

也許標題並不是描述錯誤的最佳選擇。 我會試着描述發生了什麼。Crystal Reports未顯示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"; 
} 
} 

出於某種原因不能正常工作,並沒有表現出任何結果。在系統的其他部分被用來調用類似代碼的報告,一切正常。

我可以在這裏添加其他信息來正確診斷問題。

編輯:2013年2月9日

這是我的部分觀點:

@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 

我想象的是,錯誤實際上正在經歷客戶端在您要發送的服務器上等待的那種響應。 但應該解決它?

回答

0

嘗試正確的標題爲表格後是:

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