jsview LocateDataSource里面获取Header的一种方式
Header传入 https://gcdn.grapecity.com.cn/forum.php?mod=viewthread&tid=138259&page=1#pid490463获取报表参数
private ReportParameter GRPars(Report CRpt, string parname)
{
ReportParameter rptpar = null;
try
{
for (int pi = 0; pi < CRpt.ReportParameters.Count; pi++)
{
if (CRpt.ReportParameters.Name == parname)
{
return CRpt.ReportParameters;
}
}
}
catch (Exception ex)
{
}
return rptpar;
}
Header值在UseCustomStore加入一个报表参数
settings.UseCustomStore(r =>
{
PageReport pageReport = new PageReport();
pageReport.Load(new FileInfo("报表路径"));
ReportParameter DefPar = new ReportParameter();
DefPar = new ReportParameter();
DefPar.Name ="Header";
DefPar.AllowBlank = true;
DefPar.DataType = ReportParameterDataType.String;
DefPar.Hidden = true;
DefPar.DefaultValue.Values.Add(HttpContext.Current.Request.Headers["Authorization"].ToString());
pageReport.Report.ReportParameters.Add(DefPar);
return pageReport.Report;
});
settings.LocateDataSource = arg =>
{
ReportParameter Headerparm = GRPars(arg.Report, "Header");
string Header= Headerparm.DefaultValue.Values.ToString();//获取Header值
}
:hjyzw:
页:
[1]