View Single Post
  #1 (permalink)  
Old September 8th, 2003, 04:43 AM
Braja Nayak Braja Nayak is offline
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display description of default values

Hi!,

I am trying to display the description of default values specified for the parameters in the crystal report using c#. I could display only the default

values but not the descriptions.

The code attached below works fine and displays the default values.

Any help will be highly appreciated.

Many thanks in advance,
Braja

-----------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Web;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.CommonControls;

namespace ReportViewer
{
/// <summary>
/// Summary description for Test.
/// </summary>

public class Test : System.Web.UI.Page
{

private void Page_Load(object sender, System.EventArgs e)
{

//Load the report into the report document
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load("MyReport.rpt");

ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

foreach(ParameterFieldDefinition crParameterFieldDefinition in crReportDocument.DataDefinition.ParameterFields)
{

if(crParameterFieldDefinition.DefaultValues.Count > 0)
{

Response.Write("<select name='Prompt' size='1'>");

for(int i=0;i<crParameterFieldDefinition.DefaultValues.Cou nt;i++)
{
crParameterDiscreteValue = (ParameterDiscreteValue) crParameterFieldDefinition.DefaultValues[i];
Response.Write("<option Value='" + crParameterDiscreteValue.Value + "'>" + crParameterDiscreteValue.Value + "</option>");
}

Response.Write("</select>");
}

}

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}