AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 gridview and crystal report
Posted by charan on  2/17/2010 6:03:05 AM Category: ADO.NET
Add to my favorites
Email to friend
how to write the code in asp.net with c#.net
1---for editing,updating,deleting of records in gridview

2---how to pass parameters through textbox,ropdownlist in crystal reports




using visual studio 2008 can u help

Post Your Reply Post New Question

 Viewer's Reply
How to pass parameters through textbox, dropdownlist to crystal reports?
Answered By Moderator1 on 2/20/2010 4:52:23 AM
Hi,

1. To know how to insert, update, delete records in gridview read our article at, http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx

2. To Pass parameters through code-behind to Crystal Report, follow the below syntax,

ReportDocument myreport = new ReportDocument();
myreport.Load(Server.MapPath("CrystalReport.rpt"));

ParameterFields pFields = new ParameterFields();
ParameterField pField = new ParameterField();
ParameterDiscreteValue disvalue = new ParameterDiscreteValue();
disvalue.Value = "Your Value to Pass to Parameter"

pField.Name = "@param1";
pField.CurrentValues.Add(disvalue);
pFields.Add(pField);
CrystalReportViewer1.ParameterFieldInfo = pFields;

myreport.SetDataSource(dt);
CrystalReportViewer1.ReportSource = myreport;
CrystalReportViewer1.DataBind();

Note: @param1 must be created in crystal report and placed in proper place in crystal report.
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Simply JavaScript - Free 150 Page Preview!
FierceDeveloper
Building a Web Application Security Program