Click here to Skip to main content
15,887,776 members
Home / Discussions / C#
   

C#

 
GeneralRe: Resource File Pin
Syed Shahid Hussain25-Mar-10 2:48
Syed Shahid Hussain25-Mar-10 2:48 
AnswerRe: Resource File Pin
Bernhard Hiller25-Mar-10 3:18
Bernhard Hiller25-Mar-10 3:18 
GeneralRe: Resource File Pin
Syed Shahid Hussain25-Mar-10 4:09
Syed Shahid Hussain25-Mar-10 4:09 
QuestionSerialization Pin
vamsimohan2125-Mar-10 0:11
vamsimohan2125-Mar-10 0:11 
AnswerRe: Serialization Pin
Keith Barrow25-Mar-10 0:17
professionalKeith Barrow25-Mar-10 0:17 
GeneralRe: Serialization Pin
vamsimohan2125-Mar-10 0:29
vamsimohan2125-Mar-10 0:29 
GeneralRe: Serialization Pin
Keith Barrow25-Mar-10 1:01
professionalKeith Barrow25-Mar-10 1:01 
QuestionDynamically change Crystal Report Viewer source Pin
jamesc6924-Mar-10 23:13
jamesc6924-Mar-10 23:13 
Hi,
I've written a number of Crystal reports, and I would like to get my report viewer to bind the report on change of dropdown. This does work, however for each one change it asks for the parameter information again. Below is my source - the parameters are the same across all reports and are held in session:

protected void Page_Load(object sender, EventArgs e)
{
if ((ViewState["ParametersShown"] != null) &&
(ViewState["ParametersShown"].ToString() == "True"))
{
ReportListing myListing = new ReportListing();
BindReport("MYPATH" + myListing.GetReportFileName(Session["Report"].ToString()));
}
}
protected void btnBuild_Click(object sender, EventArgs e)
{
DateTime startDate = DateTime.Parse(Session["FromDate"].ToString());
DateTime endDate = DateTime.Parse(Session["ToDate"].ToString());


ParameterFields paramFields = new ParameterFields();

ParameterField crStartDate = new ParameterField();
ParameterField crEndDate = new ParameterField();
crStartDate.Name = "@StartDate";
crEndDate.Name = "@EndDate";
ParameterDiscreteValue dcrStartDate = new ParameterDiscreteValue();
ParameterDiscreteValue dcrEndDate = new ParameterDiscreteValue();
dcrStartDate.Value = startDate;
dcrEndDate.Value = endDate;

crStartDate.CurrentValues.Add(dcrStartDate);
crEndDate.CurrentValues.Add(dcrEndDate);

paramFields.Add(crStartDate);
paramFields.Add(crEndDate);

CrystalReportViewer1.ParameterFieldInfo = paramFields;
ReportListing myListing = new ReportListing();
BindReport("MYPATH" + myListing.GetReportFileName(Session["Report"].ToString()));
ViewState["ParametersShown"] = "True";
}
private void BindReport(string FilePath)
{
ReportDocument Report = new ReportDocument();
Report.Load(FilePath);
SetTableLocation(Report.Database.Tables);
CrystalReportViewer1.ReportSource = Report;

}

private void SetTableLocation(Tables tables)
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = ConfigurationManager.AppSettings["ReportDBServerName"].ToString();
connectionInfo.DatabaseName = ConfigurationManager.AppSettings["ReportDBDBName"].ToString();
connectionInfo.UserID = ConfigurationManager.AppSettings["ReportDBUserID"].ToString();
connectionInfo.Password = ConfigurationManager.AppSettings["ReportDBPassword"].ToString();

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogOnInfo);
}

}
AnswerRe: Dynamically change Crystal Report Viewer source Pin
Rajasekhar Reddy Adam24-Mar-10 23:39
Rajasekhar Reddy Adam24-Mar-10 23:39 
Questionaccessing C API from C# Pin
mavrick2324-Mar-10 21:22
mavrick2324-Mar-10 21:22 
AnswerRe: accessing C API from C# Pin
Calla24-Mar-10 21:45
Calla24-Mar-10 21:45 
AnswerRe: accessing C API from C# Pin
Richard MacCutchan24-Mar-10 22:54
mveRichard MacCutchan24-Mar-10 22:54 
GeneralRe: accessing C API from C# Pin
mavrick2324-Mar-10 23:57
mavrick2324-Mar-10 23:57 
AnswerRe: accessing C API from C# Pin
mavrick2324-Mar-10 23:12
mavrick2324-Mar-10 23:12 
GeneralRe: accessing C API from C# Pin
Richard MacCutchan25-Mar-10 2:14
mveRichard MacCutchan25-Mar-10 2:14 
GeneralRe: accessing C API from C# Pin
Luc Pattyn25-Mar-10 3:00
sitebuilderLuc Pattyn25-Mar-10 3:00 
Questionhow to empty textbox in a groupbox Pin
crisjala24-Mar-10 16:22
crisjala24-Mar-10 16:22 
AnswerRe: how to empty textbox in a groupbox Pin
Not Active24-Mar-10 16:23
mentorNot Active24-Mar-10 16:23 
AnswerRe: how to empty textbox in a groupbox Pin
Khaniya24-Mar-10 18:33
professionalKhaniya24-Mar-10 18:33 
GeneralRe: how to empty textbox in a groupbox Pin
crisjala24-Mar-10 20:47
crisjala24-Mar-10 20:47 
QuestionMessage Removed Pin
24-Mar-10 13:50
user20524-Mar-10 13:50 
AnswerRe: Event Pin
Luc Pattyn24-Mar-10 14:13
sitebuilderLuc Pattyn24-Mar-10 14:13 
AnswerRe: Event Pin
Not Active24-Mar-10 15:11
mentorNot Active24-Mar-10 15:11 
AnswerRe: Event Pin
PIEBALDconsult24-Mar-10 16:10
mvePIEBALDconsult24-Mar-10 16:10 
GeneralRe: Event Pin
#realJSOP25-Mar-10 0:00
mve#realJSOP25-Mar-10 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.