Crystal Report: Missing Parameter Values

Posted by Chintan on Stack Overflow See other posts from Stack Overflow or by Chintan
Published on 2010-04-27T07:10:27Z Indexed on 2010/04/27 7:13 UTC
Read the original article Hit count: 373

Filed under:
|
|

Hi! I am new to Crystal report, application is on ASP.net 3.5 and MySQL 5.1 with, going to develop report with between dates from date and to date, first page of report is shown good but when i tried to navigate on another page i got error like Missing Parameter Values Thanks in advance

public partial class BookingStatement : System.Web.UI.Page {

//DAL is my Data Access Layer Class

//Book is ReportClass

DAL obj = new DAL();
Book bkStmt = new Book();
protected void Page_Load(object sender, EventArgs e)
{

    if (!IsPostBack)
    {
       //crvBooking is Crystal Report Viewer
       //reportFill method is to fill Report 

        reportFill();
        crvBooking.EnableViewState = true;
        crvBooking.EnableParameterPrompt = false;
    }


   /* Also try reportFill() out side !IsPostBack but didn't work */


    //Check if the parmeters have been shown.
 /*   if ((ViewState["ParametersShown"] != null) && (ViewState["ParametersShown"].ToString() == "True"))
    {
        bkStmt.SetParameterValue(0, "20/04/2010");
        bkStmt.SetParameterValue(1, "20/04/2010");
    }*/

}


protected void crvBooking_navigate(object sender, CrystalDecisions.Web.NavigateEventArgs e)
{
   // reportFill();
}

protected void reportFill()
{

    //bkStmt.rpt is Report file
    //bookingstatment is View
    //bkStmt is ReportClass object of Book

    string rptPath = "bkStmt.rpt";

    string query = "select * from bookingstatment";


    crvBooking.RefreshReport();
    crvBooking.Height = 600;
    crvBooking.Width = 900;



    bkStmt.ResourceName = rptPath;


    String dtFrm = bkStmt.ParameterFields[0].CurrentValues.ToString();

    obj.SetCommandType(CommandType.Text);
    obj.CommText = query;
    DataTable dtst = obj.GetDataTable();

    crvBooking.ParameterFieldInfo.Clear();



    ParameterDiscreteValue discretevalue = new ParameterDiscreteValue();
    discretevalue.Value = "20/04/2010"; // Assign parameter
    ParameterValues values = new ParameterValues();
    values.Add(discretevalue);

    bkStmt.SetDataSource(dtst);

    ViewState["ParametersShown"] = "True";
    crvBooking.EnableViewState = true;

    bkStmt.DataDefinition.ParameterFields[0].ApplyCurrentValues(values);
    bkStmt.DataDefinition.ParameterFields[1].ApplyCurrentValues(values);


    crvBooking.ReportSource = bkStmt;
}

}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#