vaquas khan

vaquas khan

  • NA
  • 45
  • 0

problem crystal report and aspx

Jan 4 2010 5:52 AM
i made a crystal report and using two parameter OrderNo,and CustName i want to display parameters on my aspx1 page ,aspx1 page
have two dropdown one for orderno and other for CustName and one button when user select the these two value from dropdown 
and click the button then its value pass to aspx2crystal report page for filtering .....please give me an example
please also suggest how to convert the dropdownlist value or datepicker selectedDate  for sesson variable..

this below code is suggested by one member of  this site  but it is not work...... 

protected
 void Button1_Click(object sender, EventArgs e) 

DropDownList1.SelectedValue = Session[
"OrderNo"].ToString(); 
} 

now in ur page2.aspx add a CrystalReportViewer and in page load add this code 
protected
 void Page_Load(object sender, EventArgs e) 

ReportDocument rpt = new ReportDocument(); 
rpt.Load(Server.MapPath(
"Report.rpt")); 
ParameterFieldDefinitions crParameterFieldDefinitions; 
ParameterFieldDefinition crParameterFieldDefinition; 
ParameterValues crParameterValues = new ParameterValues(); 
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); 
crParameterDiscreteValue.Value = Session["OrderNo"];
 
crParameterFieldDefinitions = rpt.DataDefinition.ParameterFields; 
crParameterFieldDefinition = crParameterFieldDefinitions[
"@OrderNo"]; 
crParameterValues = crParameterFieldDefinition.CurrentValues; 
crParameterValues.Clear(); 
crParameterValues.Add(crParameterDiscreteValue); 
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); 
CrystalReportViewer1.Visible = 
true
CrystalReportViewer1.ReportSource = rpt; 
CrystalReportViewer1.DisplayGroupTree = 
false
}
 

Answers (2)