Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameters from VS2008 1

Status
Not open for further replies.

ThomasBrown

Technical User
Jan 15, 2004
42
ZA
Hi Everyone,

I am not sure if this is the right forum but I will post it here and see.

I have a VS2008 Gridview, above the Gridview I have a Dropdown Control which filters the data in the GridView for the selected Year.

Attachted to this Gridview I have a Crystal report with similar data of the Gridview.

In this Crystal report I have now got a Parameter for the year as well.

So currently, the user must select a Year for the Gridview and hten when they want to print the report, they need to select the Year for the report as well.

Is there any way of passing the value in the DropDownList Control in VS2008 to the Parameter field used in Crystal?

Any assistence with this would be much appreciated.

Regards
Thomas
 
Here's an example of passing parameters from the crystal viewer to the crystal report:

crReport.SetParameterValue("LocID", txtLocID.Text)
crReport.SetParameterValue("CustID", txtCustID.Text)
crReport.SetParameterValue("OrderID", txtOrderID.Text)

crViewer1.ReportSource = crReport
The fields in "" are the parameters in the crystal report.

Good Luck
Cathy
 
Hi MzKitty,

Its not passing it form the viewer to teh report where I am having problems.

The issue is passing from a dropdown field (created in Visual Studio on a webpage) and making this the parameter field within the report, if this makes sense.

Any ideas?

Thomas
 
If the dropdown control filters the year then extract the year from it and put it in a variable that you can pass to the report. For example:

dim intYear as integer
datYear = cdate(year(ctrlYear.datavaluefield)
crReport.SetParameterValue("Year", datYear)

Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top