ASP.net crystal the method of assigning value in the code of the report parameter field _ Practical tips

Source: Internet
Author: User

The example in this article describes the method by which asp.net Crystal Report parameter fields are assigned in code. Share to everyone for your reference. The implementation method is as follows:

Declares the variables that are required to pass parameters to the viewer control. 
Parameterfields paramfields = new Parameterfields (); 
Parameterfield Paramfield = new Parameterfield (); 
Parameterdiscretevalue discreteval = new Parameterdiscretevalue (); 
Parameterrangevalue rangeval = new Parameterrangevalue (); The first parameter is a discrete parameter with multiple values. 
Sets the name of the parameter field, which must match the parameters in the report. 
Paramfield.parameterfieldname = "Customer Name"; 
Sets the first discrete value and passes it to the parameter. 
Discreteval.value = "AIC childrens"; 
PARAMFIELD.CURRENTVALUES.ADD (Discreteval); Sets the second discrete value and passes it to the parameter. 
The Discreteval variable is set to the new value so that the previous settings are not overwritten. 
Discreteval = new Parameterdiscretevalue (); 
Discreteval.value = "Aruba sport"; 
PARAMFIELD.CURRENTVALUES.ADD (Discreteval); 
Adds the parameter to the collection of parameter fields. 
Paramfields.add (Paramfield); The second parameter is the range value. 
The Paramfield variable is set to the new value so that the previous settings are not overwritten. 
Paramfield = new Parameterfield (); 
Sets the name of the parameter field, which must match the parameters in the report. 
Paramfield.parameterfieldname = "Customer ID"; 
Sets the start and end values of a range and passes the range to the parameter. 
Rangeval.startvalue = 42; 
Rangeval.endvalue = 72; 
PARAMFIELD.CURRENTVALUES.ADD (Rangeval); 
Adds the second parameter to the collection of parameter fields. Paramfields. 
ADD (Paramfield); 
Puts the collection of parameter segments into the viewer control. Crystalreportviewer1.parameterfieldinfo = Paramfields;

Here is my own application:

public void Onepage (Crystalreportviewer crystalreportviewer,int a)
{
 Parameterfields paramfields = new Parameterfields ();
 Parameterfield Paramfield = new Parameterfield ();
 Parameterdiscretevalue discreteval = new Parameterdiscretevalue ();
 The first parameter is a discrete parameter with multiple values. Sets the name of the parameter field, which must match the parameters in the report. 
 paramfield.parameterfieldname = "arc_i_id";
 Sets a discrete value and passes it to the parameter.
 discreteval.value = ID;
 PARAMFIELD.CURRENTVALUES.ADD (discreteval);
 Adds the parameter to the collection of parameter fields.
 Paramfields.add (Paramfield);
 Puts the collection of parameter segments into the viewer control. 
 crystalreportviewer.parameterfieldinfo = paramfields;
}

The first code has two parameter fields, and the second code has a parameter field.

I hope this article will help you with the ASP.net program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.