Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: CR prompt for parameter after postback Post Reply Post New Topic
Author Message
Wojciech
Newbie
Newbie


Joined: 12 Feb 2010
Online Status: Offline
Posts: 1
Quote Wojciech Replybullet Topic: CR prompt for parameter after postback
    Posted: 12 Feb 2010 at 4:22pm
Hi all,

I have problem with CrystalReport and I have no idea how fight this problem.

I wrote aspx as below:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

//for CR
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

public partial class Application_rapReport : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        ParameterDiscreteValue discrete01 = new ParameterDiscreteValue();
        ParameterField Pole01 = new ParameterField();
        ParameterFields Pola = new ParameterFields();
        ReportDocument report = new ReportDocument();
        report.Load(Server.MapPath("~//Reports//Report01.rpt"));

        Pole01.ParameterFieldName = "IDKontrah";
        discrete01.Value = int.Parse(TextBox1.Text);
        Pole01.CurrentValues.Add(discrete01);
        Pola.Add(Pole01);

        report.SetDatabaseLogon("user", "passwd", "localhost", "database");
        CrystalReportViewer1.ParameterFieldInfo = Pola;
        CrystalReportViewer1.ReportSource = report;
        CrystalReportViewer1.RefreshReport();
                  
    }
}

Abstract:
When I pass parameter to CR (from TextBox) first time after loading page- all is OK. It works. Later, when I try pass other parameter from TextBox once again (without reloading page) CR prompt me on parameter.
What do I wrong??

I set already property ReuseParameterValuesOnRefreshis set to "true", because CR prompted me about parameter every time.

I read that may put a fragment code to Page_Init, but i have no idea how split code above.
Advice me what I can to do, please. If you can give me an example I would be grateful.




Edited by Wojciech - 13 Feb 2010 at 9:00pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.