on 2014 Aug 14 10:22 AM
I have searched through forums for a solution but none seem to work for me.
I have an ASP Webform/MySql application which displays Crystal Reports.
The ones which do not require a user to enter a parameter display fine and I am able to click on export on the CR toolbar and download, e.g. .pdf format.
On the report that require a user to enter a parameter, the report renders fine but when I click on the export button, i get the prompt:
"The report you requested requires further information"
asking for DB login credentials. How can I avoid this?
My Code:
Aspx page:
......
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
.....
<div>
<CR:CrystalReportViewer Width="960px" ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</div>
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["report"] != null)
{
string reportToGet = Convert.ToString(Request.QueryString["report"]);
switch (reportToGet)
{
case "payslip":
PaySlip();
break;
case "pastpayslip":
PanelPastPaySlip.Visible = true;
break;
default:
break;
}
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
if (txtDate.Text != null || txtDate.Text != string.Empty)
if (DateTime.TryParseExact(txtDate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture,
DateTimeStyles.None, out date))
PastPaySlip();
}
private void PastPaySlip()
{
// Some code....
PayMasterDataSetTableAdapters.pastpayslipcasualviewTableAdapter ta =
new PayMasterDataSetTableAdapters.pastpayslipcasualviewTableAdapter();
PayMasterDataSet.pastpayslipcasualviewDataTable dt = new PayMasterDataSet.pastpayslipcasualviewDataTable();
ta.FillBy(dt, userId, businessId);
cReport = new ReportDocument();
string reportPath = Server.MapPath("~/Views/CasualLabour/Reports/PastPaySlip.rpt");
cReport.Load(reportPath);
cReport.SetDataSource((DataTable)dt);
cReport.SetParameterValue("Date", date);
cReport.SetDatabaseLogon("userID", "password", "server", "database");
CrystalReportViewer1.ReportSource = cReport;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
}
I am using CR V. 13.0.9 and VS 2013 Update 2
This is because almost any action on the viewer result sin a postback. This includes paging, zooming, drilling exporting and printing. E.g.; you will have to place the report in session. See the following KB for how to:
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
12 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.