I'm developing an asp.net web site.
In that web site i need to display a report with the help of crystal report.
Html
<asp:UpdatePanel ID="uPnlMain" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<asp:Button ID="btnSave" runat="server"
CssClass="btn" OnClick="btnSave_Click" Text="Show"/>
</td>
</tr>
<tr>
<td>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Report source code
protected void btnSave_Click(object sender, EventArgs e)
{
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("Reports/crptBalance.rpt"));
DSBalance dsCustomers = GetData(@"
DECLARE @DateFrom DATETIME;
DECLARE @p_Dt DATETIME;
SELECT @p_Dt = '2013-11-14 00:00:00';
SELECT TOP 1 @DateFrom = vdate FROM tblLedger WHERE fdocid = 1 AND vdate <= @p_Dt ORDER BY vdate DESC;
IF @DateFrom IS NULL BEGIN
SELECT TOP 1 @DateFrom = OpBalDate FROM tblTrnsOpBalMaster WHERE OpBalDate <= @p_Dt ORDER BY OpBalDate DESC;
END
SELECT Y.Customer,
CONVERT(VARCHAR,Y.Date,103) AS [Date],
UPPER(Y.Description) AS Description,
Y.[Due Days],
Y.Debit,
Y.Credit,
CASE WHEN Y.[Balance] >= 0 THEN Y.[Balance] ELSE -1 * Y.[Balance] END AS [Balance],
CASE WHEN Y.[Balance] >= 0 THEN 'DR' ELSE 'CR' END AS [TP] FROM
(
SELECT X.Customer,
X.Date,
X.Description,
X.[Due Days],
X.Debit,
X.Credit,
X.Debit - X.Credit AS [Balance] FROM
(
SELECT CUS.nm + ', ' + cus.[add] AS [Customer],
vdate [Date],
narration AS [Description],
DATEDIFF(DAY, vdate, GETDATE()) AS [Due Days],
CASE WHEN amttype = 'DR' THEN amt ELSE 0.0000 END AS Debit,
CASE WHEN amttype = 'CR' THEN amt ELSE 0.0000 END AS Credit
FROM tblledger LED
LEFT OUTER JOIN tblCustomer CUS ON (LED.acid = CUS.id)
WHERE acid IN (42,7) AND vdate >= @DateFrom AND vdate < @p_Dt
)X
)Y
ORDER BY Y.Customer,Y.Date");
crystalReport.SetDataSource(dsCustomers);
CrystalReportViewer1.ReportSource = crystalReport;
}
My problem is that when i use crystal report viewer inside a update panel it doesn't show any data in the report.
I mean to say that it shows blank report.
Where as without update panel it works fine.
Can any one tell me what is the problem