I have a problem to acces values on my main report in order to send it to my sub-report.
I have a main report where i display list of colors.
And i have a generic sub-report to display for comments for each color.
So the only problem that i'm facing is to acces the value of "Color Id" and send it to the sub-report.
I tried to access the textbox called "txtColorId" in order to get the value of the actual printed "Color Id" but i didn't succeed.
Is there any way to solve this issue ?
Thank you,
Regards
Pierre
The output of my report should looks like the following:
REPORT TITLE
Color Id Color Code Description
1 BLUE Blue description
Comments
1. This is a first line of comments for color Blue
2. This is a second line of comments for color Blue
3. This is a third line of comments for color Blue
2 GREEN Green description
Comments
1. These are my only comments for color Green
3 YELLOW Yellow description
Comments
not available
Here's my code for the Main report (Color):
namespace
Production_Specs_Report.Public
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Data;
/// <summary>
/// Summary description for Report1.
/// </summary>
public partial class rptSpecsColor : Telerik.Reporting.Report
{
private int _SpecsHeaderId;
private int _RevisionNumber;
private bool _PrintComment;
private bool _PrintUdfValue;
public int SpecsHeaderId
{
get
{
return _SpecsHeaderId;
}
set
{
_SpecsHeaderId =
value;
}
}
public int RevisionNumber
{
get
{
return _RevisionNumber;
}
set
{
_RevisionNumber =
value;
}
}
public bool PrintComment
{
get
{
return _PrintComment;
}
set
{
_PrintComment =
value;
}
}
public bool PrintUdfValue
{
get
{
return _PrintUdfValue;
}
set
{
_PrintUdfValue =
value;
}
}
public void ExecuteReport()
{
// -----------------------------------------------------------------------------------
// Get all Colors
// -----------------------------------------------------------------------------------
DataSet ds = new DataSet();
Production_Specs_WS.
Service v_service = new Production_Specs_WS.Service();
ds = v_service.GetSpecsColor(
this.SpecsHeaderId, this.RevisionNumber);
this.DataSource = ds;
// -----------------------------------------------------------------------------------
// Call to my subreport: Comments
// -----------------------------------------------------------------------------------
// If the user specify to print Comments for Specs Color
if (this.PrintComment == true)
{
Production_Specs_Report.Public.
rptSpecsComment v_rpt2 = new Production_Specs_Report.Public.rptSpecsComment();
v_rpt2.ReportTitle =
"Comments title";
v_rpt2.InformationType =
"101";
v_rpt2.RevisionNumber =
this.RevisionNumber;
v_rpt2.SpecsHeaderId = Convert.ToInt32(txtColorId.Value);
--------------------------> Here i'm getting a problem
v_rpt2.ExecuteReport();
if (v_rpt2.DisplayReportIfNoData == true)
{
subReportSpecsComment.ReportSource = v_rpt2;
}
else
{
subReportSpecsComment.Visible =
false;
}
v_rpt2 =
null;
}
else
{
subReportSpecsComment.Visible =
false;
}
}
public rptSpecsColor()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
// Only for test
this.PrintComment = true;
this.RevisionNumber = -1;
this.SpecsHeaderId = 2;
this.ExecuteReport();
}
}
}
Here's my code for Subreport (Comments):
namespace
Production_Specs_Report.Public
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Data;
/// <summary>
/// Summary description for Report1.
/// </summary>
public partial class rptSpecsComment : Telerik.Reporting.Report
{
private int _SpecsHeaderId;
private int _RevisionNumber;
private string _InformationType;
private string _ReportTitle;
private bool _DisplayReportIfNoData;
public int SpecsHeaderId
{
get
{
return _SpecsHeaderId;
}
set
{
_SpecsHeaderId =
value;
}
}
public int RevisionNumber
{
get
{
return _RevisionNumber;
}
set
{
_RevisionNumber =
value;
}
}
public string InformationType
{
get
{
return _InformationType;
}
set
{
_InformationType =
value;
}
}
public string ReportTitle
{
get
{
return _ReportTitle;
}
set
{
_ReportTitle =
value;
}
}
public bool DisplayReportIfNoData
{
get
{
return _DisplayReportIfNoData;
}
set
{
_DisplayReportIfNoData =
value;
}
}
public void ExecuteReport()
{
// -----------------------------------------------------------------------------------
// Specs Comment
// -----------------------------------------------------------------------------------
DataSet ds = new DataSet();
Production_Specs_WS.
Service v_service = new Production_Specs_WS.Service();
ds = v_service.GetSpecsComment(
this.SpecsHeaderId, this.RevisionNumber, this.InformationType);
if (ds.Tables[0].Rows.Count > 0)
{
this.DataSource = ds;
if (!string.IsNullOrEmpty(this.ReportTitle))
{
this.txtReportTitle.Value = this.ReportTitle.ToString();
}
this.DisplayReportIfNoData = true;
}
else
{
this.DisplayReportIfNoData = false;
}
}
public rptSpecsComment()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
}
}
}