Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: crystal report asp.net 2.0 C# Post Reply Post New Topic
Author Message
vyasdipti
Newbie
Newbie
Avatar

Joined: 17 Nov 2008
Location: India
Online Status: Offline
Posts: 3
Quote vyasdipti Replybullet Topic: crystal report asp.net 2.0 C#
    Posted: 17 Nov 2008 at 10:27pm
Since yesterday i got stuck up with this problem.
 
I want to show the report of Customer caste wise. In database i have tables like (1) tblcaste (2) tblcustomer. In tblcustomer i have casteid which is primary key of tblcaste.
 
In aspx page there is one dropdown box having various caste. User will select any one caste and click on button show report. Then report will be shown that following are the customer of this caste.
 
I could get the selected item of dropdown box in a variable. Also, without any programming through wizard i m able to see the report. But i m unable to pass the value of dropdown box to a report. Please note that my report page and my dropdown page is same. On click of button show report i m making report visible.
 
 
 
FYI, I m using asp.net 2.0 and C# as code behind language.


Edited by vyasdipti - 17 Nov 2008 at 10:27pm
dIPTI vYAS
Arete Technologies Pvt Ltd
Sr.Systems Analyst
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 18 Nov 2008 at 12:31am
No problem. In your report create a parameter for the Caste ID and then create a record selection formula that filters on it. Test it to make sure it works. In your code, after loading the report document into memory, pass the drop down's value to that parameter using the SetParameterValue() method of the ReportDocument object. Using pseudo-code, it would look like this:
myReport.SetParameterValue("paramname", var);
 
I have all this fully documented in Chapter 2 of my Crystal Reports Encyclopedia Vol 2 book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
vyasdipti
Newbie
Newbie
Avatar

Joined: 17 Nov 2008
Location: India
Online Status: Offline
Posts: 3
Quote vyasdipti Replybullet Posted: 18 Nov 2008 at 2:19am
THanks Brian.
 
But i have one doubt, what is 'var' in the bracket beside paramname. Becoz i tried that, but its giving error.
 
FYI, i have declared one string variable in which i m taking the value of dropdownbox like,
 
string abc = ddlcaste.selecteditem.tostring();
CrystalDecisions.CrystalReports.Engine.ReportDocument obj1 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

obj1.Load("E:\\Projects\\Oberoi Finance\\Latest_oberoiProject-14-11\\Reports\\castereport.rpt");

obj1.SetParameterValue ("castename", var);

CrystalReportViewer1.ReportSource = obj1;

 

but here var is giving a compilation error. Please suggest.



Edited by vyasdipti - 18 Nov 2008 at 2:20am
dIPTI vYAS
Arete Technologies Pvt Ltd
Sr.Systems Analyst
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 18 Nov 2008 at 9:02am
"var" is the variable name that holds the value from your dropdown list. In your sample code, you should change it to this:
 

obj1.SetParameterValue ("castename", abc);

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.