我的主报告包含两个从ASP.NET MVC 5.0(VS 2015)调用的子报告,但有时主报告缺少一个子报告(不是两个)的数据。
如果我重新加载页面,则显示所有数据。
错误是什么?
LocalReport reportViewerLocal = new LocalReport();
...
reportViewerLocal.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessingComprobanteRol);
...
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline");
Response.AddHeader("Content-Length", renderedBytes.Length.ToString());
Response.BinaryWrite(renderedBytes);
void SubreportProcessingComprobanteRol(object sender, SubreportProcessingEventArgs e)
{
// Defino Parametro
string param1 = e.Parameters["ParamSubReporteIdPersona"].Values[0];
string param2 = e.Parameters["ParamSubReporteTipoMovimiento"].Values[0];
// Designo DataSet según parametro
string dataSourceName = e.DataSourceNames[0];
List<MovimientoRolModel> lista = ((IEnumerable) dataSourceDetalleComprobanteRol).Cast<MovimientoRolModel>().ToList();
List<MovimientoRolModel> movimiento = lista.Where(p => p.IdPersona == Convert.ToInt32(param1) && p.TipoMovimiento == Convert.ToInt32(param2)).ToList();
e.DataSources.Clear();
ReportDataSource datasourceDetalle = new ReportDataSource(dataSourceName, movimiento);
e.DataSources.Add(datasourceDetalle);
}
答案 0 :(得分:0)
今天,我添加了这些内容:
<span id="hej"><a id="videoLink" href="">This becomes a search link</a></span>
<script>
$.ajax({
url: "game.php",
type: "post",
async: true,
dataType: 'json',
success: function(data){
$("#hej").find("#videoLink").attr("href",'http://www.example.net/search?q=' + data.gameName);
/* Cut data.gameName properly here */
}
});
</script>
我认为这是解决方案,因为今天重新加载了页面。