Telerik Forums
Reporting Forum
1 answer
710 views
I have downloaded a trial version for using in my application.
datasource need to be bind on runtime and should change on change of a dropdownlist
this is what my classlibrarylooks alike:

namespace

ClassLibrary1

 

{

 

using System;

 

 

using System.Data;

 

 

using System.ComponentModel;

 

 

using System.Drawing;

 

 

using System.Windows.Forms;

 

 

using Telerik.Reporting;

 

 

using Telerik.Reporting.Drawing;

 

 

/// <summary>

 

 

/// Summary description for Report1.

 

 

/// </summary>

 

 

public partial class Report1 : Telerik.Reporting.Report

 

{

 

public string constr;

 

 

public Report1(string cnstr)

 

{

 

/// <summary>

 

 

/// Required for telerik Reporting designer support

 

 

/// </summary>

 

InitializeComponent();

System.Data.OleDb.

OleDbConnection cn = new System.Data.OleDb.OleDbConnection();

 

System.Data.OleDb.

OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();

 

System.Data.OleDb.

OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();

 

 

DataTable dt = new DataTable();

 

cn.ConnectionString = cnstr;

constr = cnstr;

cmd.CommandText =

"Select * from company";

 

cmd.Connection = cn;

da.SelectCommand = cmd;

da =

new System.Data.OleDb.OleDbDataAdapter("Select * from company", cnstr);

 

 

this.DataSource = da;

 

 

}

 

 

private void Report1_NeedDataSource(object sender, System.EventArgs e)

 

{

 

string sql =

 

 

@"Select * from company";

 

 

//da.SelectCommand = new System.Data.OleDb.OleDbCommand(sql);

 

System.Data.OleDb.

OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sql,constr);

 

 

 

DataSet dataSet = new DataSet();

 

da.Fill(dataSet);

(sender

as Telerik.Reporting.Processing.Report).DataSource = dataSet;

 

}

 

private void textBox2_ItemDataBound(object sender, EventArgs e)

 

{

Telerik.Reporting.Processing.

TextBox txtPosition = (Telerik.Reporting.Processing.TextBox)sender;

 

 

if (txtPosition.Text.Contains("Developer"))

 

{

txtPosition.Style.BackgroundColor =

Color.Blue;

 

}

}

 

}

}

this is how designer code looks :

 

namespace

ClassLibrary1

 

{

 

using System.ComponentModel;

 

 

using System.Drawing;

 

 

using System.Windows.Forms;

 

 

using Telerik.Reporting;

 

 

using Telerik.Reporting.Drawing;

 

 

partial class Report1

 

 

 

{

 

 

#region

Component Designer generated code

 

 

/// <summary>

 

 

 

 

/// Required method for telerik Reporting designer support - do not modify

 

 

 

 

/// the contents of this method with the code editor.

 

 

 

 

/// </summary>

 

 

 

 

private void InitializeComponent()

 

{

Telerik.Reporting.Drawing.

StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();

 

Telerik.Reporting.Drawing.

StyleRule styleRule2 = new Telerik.Reporting.Drawing.StyleRule();

 

Telerik.Reporting.Drawing.

StyleRule styleRule3 = new Telerik.Reporting.Drawing.StyleRule();

 

Telerik.Reporting.Drawing.

StyleRule styleRule4 = new Telerik.Reporting.Drawing.StyleRule();

 

 

this.dataSet = new ClassLibrary1.DataSet();

 

 

this.labelsGroupHeader = new Telerik.Reporting.GroupHeaderSection();

 

 

this.labelsGroupFooter = new Telerik.Reporting.GroupFooterSection();

 

 

this.labelsGroup = new Telerik.Reporting.Group();

 

 

this.pageHeader = new Telerik.Reporting.PageHeaderSection();

 

 

this.reportNameTextBox = new Telerik.Reporting.TextBox();

 

 

this.pageFooter = new Telerik.Reporting.PageFooterSection();

 

 

this.currentTimeTextBox = new Telerik.Reporting.TextBox();

 

 

this.pageInfoTextBox = new Telerik.Reporting.TextBox();

 

 

this.reportHeader = new Telerik.Reporting.ReportHeaderSection();

 

 

this.titleTextBox = new Telerik.Reporting.TextBox();

 

 

this.detail = new Telerik.Reporting.DetailSection();

 

 

this.dataSetTableAdapter1 = new ClassLibrary1.DataSetTableAdapters.DataSetTableAdapter();

 

 

this.textBox1 = new Telerik.Reporting.TextBox();

 

((System.ComponentModel.

ISupportInitialize)(this.dataSet)).BeginInit();

 

((System.ComponentModel.

ISupportInitialize)(this)).BeginInit();

 

 

//

 

 

 

 

// dataSet

 

 

 

 

//

 

 

 

 

this.dataSet.DataSetName = "DataSet";

 

 

this.dataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;

 

 

//

 

 

 

 

// labelsGroupHeader

 

 

 

 

//

 

 

 

 

this.labelsGroupHeader.Height = new Telerik.Reporting.Drawing.Unit(0.28125, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.labelsGroupHeader.Name = "labelsGroupHeader";

 

 

this.labelsGroupHeader.PrintOnEveryPage = true;

 

 

//

 

 

 

 

// labelsGroupFooter

 

 

 

 

//

 

 

 

 

this.labelsGroupFooter.Height = new Telerik.Reporting.Drawing.Unit(0.28125, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.labelsGroupFooter.Name = "labelsGroupFooter";

 

 

this.labelsGroupFooter.Style.Visible = false;

 

 

//

 

 

 

 

// labelsGroup

 

 

 

 

//

 

 

 

 

this.labelsGroup.Bookmark = null;

 

 

this.labelsGroup.GroupFooter = this.labelsGroupFooter;

 

 

this.labelsGroup.GroupHeader = this.labelsGroupHeader;

 

 

//

 

 

 

 

// pageHeader

 

 

 

 

//

 

 

 

 

this.pageHeader.Height = new Telerik.Reporting.Drawing.Unit(0.28125, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.pageHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

 

 

this.reportNameTextBox});

 

 

this.pageHeader.Name = "pageHeader";

 

 

//

 

 

 

 

// reportNameTextBox

 

 

 

 

//

 

 

 

 

this.reportNameTextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.02083333395421505, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.reportNameTextBox.Name = "reportNameTextBox";

 

 

this.reportNameTextBox.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(6.4166665077209473, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.reportNameTextBox.StyleName = "PageInfo";

 

 

this.reportNameTextBox.Value = "Report1";

 

 

//

 

 

 

 

// pageFooter

 

 

 

 

//

 

 

 

 

this.pageFooter.Height = new Telerik.Reporting.Drawing.Unit(0.28125, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.pageFooter.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

 

 

this.currentTimeTextBox,

 

 

this.pageInfoTextBox});

 

 

this.pageFooter.Name = "pageFooter";

 

 

//

 

 

 

 

// currentTimeTextBox

 

 

 

 

//

 

 

 

 

this.currentTimeTextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.02083333395421505, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.currentTimeTextBox.Name = "currentTimeTextBox";

 

 

this.currentTimeTextBox.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.1979167461395264, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.currentTimeTextBox.StyleName = "PageInfo";

 

 

this.currentTimeTextBox.Value = "=NOW()";

 

 

//

 

 

 

 

// pageInfoTextBox

 

 

 

 

//

 

 

 

 

this.pageInfoTextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.2395832538604736, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.pageInfoTextBox.Name = "pageInfoTextBox";

 

 

this.pageInfoTextBox.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.1979167461395264, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.pageInfoTextBox.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right;

 

 

this.pageInfoTextBox.StyleName = "PageInfo";

 

 

this.pageInfoTextBox.Value = "=PageNumber";

 

 

//

 

 

 

 

// reportHeader

 

 

 

 

//

 

 

 

 

this.reportHeader.Height = new Telerik.Reporting.Drawing.Unit(0.80823493003845215, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.reportHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

 

 

this.titleTextBox});

 

 

this.reportHeader.Name = "reportHeader";

 

 

//

 

 

 

 

// titleTextBox

 

 

 

 

//

 

 

 

 

this.titleTextBox.Name = "titleTextBox";

 

 

this.titleTextBox.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(6.4583334922790527, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.78740161657333374, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.titleTextBox.StyleName = "Title";

 

 

this.titleTextBox.Value = "Report1";

 

 

//

 

 

 

 

// detail

 

 

 

 

//

 

 

 

 

this.detail.Height = new Telerik.Reporting.Drawing.Unit(0.28125, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

 

 

this.textBox1});

 

 

this.detail.Name = "detail";

 

 

//

 

 

 

 

// dataSetTableAdapter1

 

 

 

 

//

 

 

 

 

this.dataSetTableAdapter1.ClearBeforeFill = true;

 

 

//

 

 

 

 

// textBox1

 

 

 

 

//

 

 

 

 

this.textBox1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.19999997317790985, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.081210456788539886, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.textBox1.Name = "textBox1";

 

 

this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1.9000000953674316, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000012218952179, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

this.textBox1.Value = "[=Fields.[Company Name]]";

 

 

//

 

 

 

 

// Report1

 

 

 

 

//

 

 

 

 

this.Groups.AddRange(new Telerik.Reporting.Group[] {

 

 

this.labelsGroup});

 

 

this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

 

 

this.labelsGroupHeader,

 

 

this.labelsGroupFooter,

 

 

this.pageHeader,

 

 

this.pageFooter,

 

 

this.reportHeader,

 

 

this.detail});

 

 

this.PageSettings.Landscape = false;

 

 

this.PageSettings.Margins.Bottom = new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.PageSettings.Margins.Left = new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.PageSettings.Margins.Right = new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.PageSettings.Margins.Top = new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;

 

 

this.Style.BackgroundColor = System.Drawing.Color.White;

 

styleRule1.Selectors.AddRange(

new Telerik.Reporting.Drawing.ISelector[] {

 

 

new Telerik.Reporting.Drawing.StyleSelector("Title")});

 

styleRule1.Style.Color = System.Drawing.

Color.Black;

 

styleRule1.Style.Font.Bold =

true;

 

styleRule1.Style.Font.Italic =

false;

 

styleRule1.Style.Font.Name =

"Tahoma";

 

styleRule1.Style.Font.Size =

new Telerik.Reporting.Drawing.Unit(20, Telerik.Reporting.Drawing.UnitType.Point);

 

styleRule1.Style.Font.Strikeout =

false;

 

styleRule1.Style.Font.Underline =

false;

 

styleRule2.Selectors.AddRange(

new Telerik.Reporting.Drawing.ISelector[] {

 

 

new Telerik.Reporting.Drawing.StyleSelector("Caption")});

 

styleRule2.Style.Color = System.Drawing.

Color.Black;

 

styleRule2.Style.Font.Name =

"Tahoma";

 

styleRule2.Style.Font.Size =

new Telerik.Reporting.Drawing.Unit(11, Telerik.Reporting.Drawing.UnitType.Point);

 

styleRule2.Style.VerticalAlign = Telerik.Reporting.Drawing.

VerticalAlign.Middle;

 

styleRule3.Selectors.AddRange(

new Telerik.Reporting.Drawing.ISelector[] {

 

 

new Telerik.Reporting.Drawing.StyleSelector("Data")});

 

styleRule3.Style.Font.Name =

"Tahoma";

 

styleRule3.Style.Font.Size =

new Telerik.Reporting.Drawing.Unit(11, Telerik.Reporting.Drawing.UnitType.Point);

 

styleRule3.Style.VerticalAlign = Telerik.Reporting.Drawing.

VerticalAlign.Middle;

 

styleRule4.Selectors.AddRange(

new Telerik.Reporting.Drawing.ISelector[] {

 

 

new Telerik.Reporting.Drawing.StyleSelector("PageInfo")});

 

styleRule4.Style.Font.Name =

"Tahoma";

 

styleRule4.Style.Font.Size =

new Telerik.Reporting.Drawing.Unit(11, Telerik.Reporting.Drawing.UnitType.Point);

 

styleRule4.Style.VerticalAlign = Telerik.Reporting.Drawing.

VerticalAlign.Middle;

 

 

this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {

 

styleRule1,

styleRule2,

styleRule3,

styleRule4});

 

this.Width = new Telerik.Reporting.Drawing.Unit(6.4583334922790527, Telerik.Reporting.Drawing.UnitType.Inch);

 

((System.ComponentModel.

ISupportInitialize)(this.dataSet)).EndInit();

 

((System.ComponentModel.

ISupportInitialize)(this)).EndInit();

 

}

 

 

#endregion

 

 

 

private GroupHeaderSection labelsGroupHeader;

 

 

private GroupFooterSection labelsGroupFooter;

 

 

private Group labelsGroup;

 

 

private PageHeaderSection pageHeader;

 

 

private Telerik.Reporting.TextBox reportNameTextBox;

 

 

private PageFooterSection pageFooter;

 

 

private Telerik.Reporting.TextBox currentTimeTextBox;

 

 

private Telerik.Reporting.TextBox pageInfoTextBox;

 

 

private ReportHeaderSection reportHeader;

 

 

private Telerik.Reporting.TextBox titleTextBox;

 

 

private DetailSection detail;

 

 

private DataSet dataSet;

 

 

private ClassLibrary1.DataSetTableAdapters.DataSetTableAdapter dataSetTableAdapter1;

 

 

private Telerik.Reporting.TextBox textBox1;

 

}

}

now when i try to use this class from webreport viewer :

 

ClassLibrary1.

Report1 rpt = new ClassLibrary1.Report1(cn.ConnectionString);

 

rpt.constr = cn.ConnectionString;

 

ReportViewer1.Report = rpt;

Viewer shows this twice :

An error has occured while processing TextBox 'textBox1':
Missing operator before Name operand.
An error has occured while processing TextBox 'textBox1':
Missing operator before Name operand.


can you tell me whats going wrong wrong?

Steve
Telerik team
 answered on 16 Nov 2009
1 answer
92 views


hi.

error message :

http://domain.co.kr/Telerik.Report.Viewer.axd?culture=ko-


why korean language does not printed on the papaer even though already press the print button


i can't Print. why error message?
i can't korean language print ???

language : korean



sample source plz..

wingsbox@gmail.com




Steve
Telerik team
 answered on 13 Nov 2009
2 answers
87 views
I watched Evan Hutnick's Webinar today and It's great to see Telerik reporting has made it to Silverlight. The implementation seems to be fairly straight forward. Although, I have several questions about the Communication between the SL Viewer and Report processor, but I'll differ those questions to another post.

However, I have an important question in regards to exporting to XPS.
a) I saw that viewer has a button that the user can select to export to XPS. Is it possible not to show the viewer and through code export that XPS to a local storage? My goal is for the Report processor to create the report, the communication delivers that to SL client, and then I can save it as XPS to show it in my Silverlight app in my own way?
b) If not, is it possible that we can generate the XPS at the service level (Report processor) and then send the XPS to SL client?

Basically, I need a way to show a nicely created XPS report that I can display in my own Silverlight app, rather than Report Viewer?

Thanks!
..Ben
Svetoslav
Telerik team
 answered on 13 Nov 2009
1 answer
188 views
Hello,
We have currently come into the situation where we will need to be showing large sets of data.  Currently our reports will not get over a few hundred pages in length at the max.  When I say larger, I'm not exactly sure how large just yet.  All I know is that a few of the reports I've tried to test have ended with the server running out of memory trying to "Generate Report".

My question here is what are the stress limitations of the Telerik Reporting tool?  How many pages of data with say 10 columns can the viewer show before it physically won't do it?  I know a lot of that is dependent on hardware specs of the server but there has to be some number somewhere.

Also I've been reading over the
knowledge base article trying to tweek some performance issues.  This however, hasn't helped that much considering sub reports will not work in my particular situation. Some of these larger reports are just flat forms of data that can't be broken out.

So from all this there are two major questions that I have.  

1) Is there a way to put a timeout on the "Generating Report" so that the server doesn't sit there and spin, bogging down everyone else?
2) Is there a way to somehow not load the entire report into memory.  Is there a built in way to not have each page stored or created at initial runtime?

Basically I'm just looking for any and all performance tuning practices that I could potentially use to make these very large reports run. 

Also the database returns the datasets back fairly quickly.  The database has never been a problem in any of these issues.

Thank you,

Chris McMahan
Steve
Telerik team
 answered on 13 Nov 2009
4 answers
706 views
Hi everybody,

i want to change the row's color when (RowNumber Mod 2 == 0) in Design time but
it doesnt work...

i print on each row the RowNumber in a textbox and it always prints RowNumber = 1...
So, anyone have an idea?

i saw this example but that doesnt work...

http://www.telerik.com/support/kb/reporting/customization-tip/displaying-data-with-alternating-style-rows.aspx

I want to do it in design time...

Thanks....
Daniel BOTERO CORREA
Daniel Botero Correa
Top achievements
Rank 1
 answered on 13 Nov 2009
7 answers
206 views
Hi

I would like the RadFormDecorator to skin the reportviewer , i have managed to implement a custom skin and custom css for the viewer but i am unable to style all aspects of the control. Can you please inform me how i can style to following;

PreviewButton
Change the text (to be "Refresh" ) and skin to RadFormDecorator style  (Black... etc )
Parameters Panel
apply a background image
Parameters Drop Down List Box
Change skin to RadFormDecorator style
Report Viewer Scroll Bar
Change skin to RadFormDecorator style

Please see Pic1 below for an example

The odd thing is that the Drop Down List Box scroll bars are affected by the RadFormDecorator style  but nothing else ( please see pic2 below )


Pic1
pic2

Regards,

Richard C

Steve
Telerik team
 answered on 13 Nov 2009
0 answers
209 views

 

private void groupHeaderSection1_ItemDataBinding(object sender, EventArgs e)

 

{

 

if (_openingFuelBalance != null && _closingFuelBalance != null)

 

{

Telerik.Reporting.Processing.

GroupSection section = sender as Telerik.Reporting.Processing.GroupSection;
***************************************************************************

 

 

DataRowView row = section.DataItem as DataRowView;

 

 

********************************************************************************
object
val = row.Row["PrimeMover"];

 

_openingFuelBalance =

blFuelBalance.ListRecordOpening(val.ToInt(), strDateFrom, strDateTo);

 

_closingFuelBalance =

blFuelBalance.ListRecordClosing(val.ToInt(), strDateFrom, strDateTo);

 

 

if (_openingFuelBalance != null && _closingFuelBalance != null)

 

{

txtBF.Value = _openingFuelBalance.LastOdometer.ToString();

}

 

else

 

{

txtBF.Value =

"0";

 

txtCheckDigit.Value =

"0";

 

txtTtlDiff.Value =

"0";

 

}

}

}



When I generate the Telerik Report, the row that I mark as Asterik (*) ,it come  out the error dataset does not support system.nullable. Can your all help me to solve this problem. Is it problem cause by linQ. I use Linq to retreive the data.Thank you very much for your all  help.
prince chun
Top achievements
Rank 1
 asked on 13 Nov 2009
4 answers
159 views
Hi support,

I was wondering if it was possible to place a report viewer inside a nested view template in a RadGrid.  When I did so, I set the report up and it didn't work.  The same report worked fine in the page load event of the same page, but on placing the reportviewer inside the nestedviewtemplate of a grid the report didn't work.

Thanks,
Josh
Josh
Top achievements
Rank 1
 answered on 12 Nov 2009
3 answers
89 views
Hi,

Does anyone know how i should fix the layout of the following report (attachment)?
there is a problem with the size of the textboxes of the datafields...

thx in front.
Steve
Telerik team
 answered on 12 Nov 2009
2 answers
185 views
Hello,

I updated our reports to version 3.2.9.1104 and most of them broke. The reports that broke the only difference i could see is they are using ArrayLists populated with BusinessObjects, If I use an ObservableCollection<T> it seems to work just fine. Any help on this problem would be great.

some sample code
this one works
public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
            ReportViewer rv = new ReportViewer(); 
            Report1 rpt = new Report1(); 
 
            ObservableCollection<MyObject> ary = GenerateData(); 
 
            rpt.DataSource = ary; 
            rv.Report = rpt; 
            rv.RefreshReport();
            //wfh is WindowsFormsHost
            wfh.Child = rv; 
        } 
 
 
        private static ObservableCollection<MyObject> GenerateData() 
        { 
            ObservableCollection<MyObject> data = new ObservableCollection<MyObject>(); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Europe", Sales = 11 }); 
 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Europe", Sales = 12 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Europe", Sales = 13 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Europe", Sales = 14 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Asia", Sales = 15 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Asia", Sales = 16 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Asia", Sales = 17 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Asia", Sales = 17 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Africa", Sales = 19 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Africa", Sales = 20 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Africa", Sales = 21 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Africa", Sales = 22 }); 
 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Europe", Sales = 111 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Europe", Sales = 112 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Europe", Sales = 113 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Europe", Sales = 114 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Asia", Sales = 115 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Asia", Sales = 116 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Asia", Sales = 117 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Asia", Sales = 118 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Africa", Sales = 119 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Africa", Sales = 120 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Africa", Sales = 121 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Africa", Sales = 122 }); 
 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Europe", Sales = 22 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Europe", Sales = 23 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Europe", Sales = 24 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Europe", Sales = 25 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Asia", Sales = 26 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Asia", Sales = 27 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Asia", Sales = 28 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Asia", Sales = 29 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Africa", Sales = 30 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Africa", Sales = 31 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Africa", Sales = 32 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Africa", Sales = 33 }); 
 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Europe", Sales = 122 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Europe", Sales = 123 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Europe", Sales = 124 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Europe", Sales = 125 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Asia", Sales = 126 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Asia", Sales = 127 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Asia", Sales = 128 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Asia", Sales = 129 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Africa", Sales = 130 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Africa", Sales = 131 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Africa", Sales = 132 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Africa", Sales = 133 }); 
 
            return data; 
        } 
    } 
 
    public class MyObject 
    { 
        public string Make 
        { 
            get
            set
        } 
 
        public string Quarter 
        { 
            get
            set
        } 
 
        public int Year 
        { 
            get
            set
        } 
 
        public string Region 
        { 
            get
            set
        } 
 
        public decimal Sales 
        { 
            get
            set
        } 
    } 

this one doesn't
public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
            ReportViewer rv = new ReportViewer(); 
            Report1 rpt = new Report1(); 
 
            ArrayList ary = GenerateData(); 
 
            rpt.DataSource = ary; 
            rv.Report = rpt; 
            rv.RefreshReport();
            //wfh is WindowsFormsHost
            wfh.Child = rv; 
        } 
 
 
        private static ArrayList GenerateData() 
        { 
            ArrayList data = new ArrayList(); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Europe", Sales = 11 }); 
 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Europe", Sales = 12 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Europe", Sales = 13 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Europe", Sales = 14 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Asia", Sales = 15 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Asia", Sales = 16 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Asia", Sales = 17 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Asia", Sales = 17 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Tata", Region = "Africa", Sales = 19 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Tata", Region = "Africa", Sales = 20 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Tata", Region = "Africa", Sales = 21 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Tata", Region = "Africa", Sales = 22 }); 
 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Europe", Sales = 111 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Europe", Sales = 112 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Europe", Sales = 113 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Europe", Sales = 114 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Asia", Sales = 115 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Asia", Sales = 116 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Asia", Sales = 117 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Asia", Sales = 118 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Tata", Region = "Africa", Sales = 119 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Tata", Region = "Africa", Sales = 120 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Tata", Region = "Africa", Sales = 121 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Tata", Region = "Africa", Sales = 122 }); 
 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Europe", Sales = 22 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Europe", Sales = 23 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Europe", Sales = 24 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Europe", Sales = 25 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Asia", Sales = 26 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Asia", Sales = 27 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Asia", Sales = 28 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Asia", Sales = 29 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q1", Make = "Toyota", Region = "Africa", Sales = 30 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q2", Make = "Toyota", Region = "Africa", Sales = 31 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q3", Make = "Toyota", Region = "Africa", Sales = 32 }); 
            data.Add(new MyObject() { Year = 2007, Quarter = "Q4", Make = "Toyota", Region = "Africa", Sales = 33 }); 
 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Europe", Sales = 122 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Europe", Sales = 123 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Europe", Sales = 124 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Europe", Sales = 125 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Asia", Sales = 126 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Asia", Sales = 127 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Asia", Sales = 128 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Asia", Sales = 129 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q1", Make = "Toyota", Region = "Africa", Sales = 130 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q2", Make = "Toyota", Region = "Africa", Sales = 131 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q3", Make = "Toyota", Region = "Africa", Sales = 132 }); 
            data.Add(new MyObject() { Year = 2008, Quarter = "Q4", Make = "Toyota", Region = "Africa", Sales = 133 }); 
 
            return data; 
        } 
    } 
 
    public class MyObject 
    { 
        public string Make 
        { 
            get
            set
        } 
 
        public string Quarter 
        { 
            get
            set
        } 
 
        public int Year 
        { 
            get
            set
        } 
 
        public string Region 
        { 
            get
            set
        } 
 
        public decimal Sales 
        { 
            get
            set
        } 
    } 


Thanks Much
~Boots
Boots
Top achievements
Rank 1
 answered on 12 Nov 2009
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?