Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Crystal report not showing data when click on export/ print options in asp.net

Feb 11, 2012
Introduction:

In this article I will explain how to solve the problem of showing data when click on export/print options in crystal report using asp.net.


Description:

In Previous posts I explained many articles relating to crystal reports. During work with crystal report I find problem to display data when click on Print/Export options in crystal report using asp.net. To solve this problem I made small modification in my code to display data when click on print/export options in crystal report. 

Whenever we click on print or Export button in crystal report it will go to pageload during that time we need to bind the report data every time. If you place report binding in !IsPostBack condition place it in outside.

First I written code like this 


protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindReportData(name);
}
}
After research I modified this pageload method is like this 


protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
}
BindReportData(name);
}
By making above code modification we got crystal report data whenever we click on print or export button. I hope it helps someone.

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

12 comments :

Anonymous said...

hi,

do you know how to print receipts using vb.net.. if you know pleace post a sample programe.. thank you..

Anonymous said...

please clarify bindreport(data) with examlpe

Suresh Dasari said...

BindReport(data) is the method which i used to bind data to report

fizmhd said...
This comment has been removed by the author.
Anonymous said...

We have to export to excel the data in crystal report viewer.. Does it requires MS office installed on server. Please put some sample code, the excel file has to save on client macchine

Unknown said...

Dear Suresh,
When I browse report on design time, I get data as I designed the report. But when I run my full application like "http://www.myapp.com/rpt.aspx" or "111.111.111.111/rpt.aspx" it shows nothing but a blank page. Plz solve the problem.

Unknown said...

Dear Suresh,

Crystal report viewer option is not visible in toolbox,can u help me how to add that field in toolbox,I', using visual Studio 2010

Rmk said...

BindReportData(name);
what we should right in it?

Anonymous said...

hi suresh sir... can u give u r mobile number....... i need one help....

Unknown said...
This comment has been removed by the author.
Unknown said...

Hi Suresh....!

This site is very usefull to all. I am just following your tutorial.

please tell me one thing


BindReport(data) method has not used while pass parameter.

plz see http://www.aspdotnet-suresh.com/2012/01/pass-parameters-to-crystal-reports-in.html

Now can you please tell me where i put this code. I am very thank full to you if you could send a sample to me. My email ID is 145iloveindia@gmail.com

Thank you very much in advance.

Anonymous said...

thanks solved when i am calling function on pageload, but i am calling my function click buttion

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.