This is a migrated thread and some comments may be shown as answers.

Problem while accessing values on report

1 Answer 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pierre Namroud
Top achievements
Rank 1
Pierre Namroud asked on 10 Mar 2009, 08:54 PM
Dear Sir,

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();

}

 

}

}




1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 11 Mar 2009, 11:35 AM
Hello Pierre,

The code you've pasted is unreadable, so can you please prepare a sample project exhibiting the problem, zip it and attach it to this thread? Once we review it, we would be able to provide you with more info.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Pierre Namroud
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or