Telerik Forums
Reporting Forum
2 answers
230 views
Hi,

I just created a few simple reports, used the query builder (data preview shows some records, so data config is ok), specified groups, items etc. When i press preview or just show report on website, it shows no data. I followed a tutorial from learning guide.
Please help, i need to show a report it to customer tomorrow..

Sample solution (using AdventureWorks database)- http://vitexner.eu/testpp.zip

Best regards

Vit Exner
Exi
Top achievements
Rank 2
 answered on 17 Nov 2009
3 answers
724 views

For my application I need to build report parameters programmatically.  I have tried to follow the examples available but I cannot get the parameters to display as a dropdown list of values.  The parameter does show up in the viewer but as a textbox.  Below is the code that I am using to build my parameter -  

 

 

Dim vals As New ArrayList   
 <fill vals with strings of option values> 
 
Dim param As New ReportParameter   
param.Type = ReportParameterType.String  
param.UI.Visible = True   
param.UI.MultiValue = True   
param.Value = vals   
   
Me.ReportParameters.Add(param)  
 
 

This is wrapped in a routine that is called when the report is bound to it's data source.  When I try to call the routine from the report's constructor it results in a run-time error.

My questions are:
1. How do I get my options to show up as a dropdown list?
2. When should this routine be called? 
3. Is it possible to build it with a value/key pair rather than just a list of values? 

----------------------------------------------------------------------------------------------------------------
Upon further investigation, either programmatic definition of parameters is not supported or the documentation is severely lacking because I have tried every example (there are just a few) that I can find and it either results in no parameter or a run-time error.  For example, just trying to add a simple test parameter with the following code results in no parameter in the viewer:

    Public Sub New()  
        InitializeComponent()  
        ReportParameters.Add("Test", ReportParameterType.String"test")  
    End Sub 

Thanks,
Dave

 

 

 

 

 

 

 

Kristy
Top achievements
Rank 1
 answered on 17 Nov 2009
1 answer
214 views
Hi,

I have a table in wich the datasource is loaded in the NeedDataSource event.  It's using a Stored Procedure wich requires as parameter a value that is available in the main report.  How do I access this value ?

I want to either get the value of textbox txtIndividualId or the field IndividualId from the Reports datasource...

Thanks

private void MyTable_NeedDataSource(object sender, EventArgs e)  
{  
    SqlCommand sqlSelectCommand = new SqlCommand  
                                      {  
                                            CommandText = "SP_MyStoredProc",  
                                            Connection = new SqlConnection {ConnectionString = ConnectionString},  
                                            CommandType = CommandType.StoredProcedure  
                                      };  
    sqlSelectCommand.Parameters.Add("@individualId", SqlDbType.Int);  
    sqlSelectCommand.Parameters["@individualId"].Value = txtIndividualId.Value; //This is incorrect  
      
    Telerik.Reporting.Processing.Table tbl = (Telerik.Reporting.Processing.Table)sender;  
    tbl.DataSource = new SqlDataAdapter { SelectCommand = sqlSelectCommand };  
}  
 
Steve
Telerik team
 answered on 17 Nov 2009
1 answer
153 views
I'm having an issue when exporting a report to pdf. The Pie chart mirrors itself. Any ideas?
Steve
Telerik team
 answered on 17 Nov 2009
1 answer
137 views
Hi,

My question is does Telerik Report can use LINQ like integrated Datasource ?

Z. Rusev
Steve
Telerik team
 answered on 16 Nov 2009
0 answers
131 views

Hi,
 I want to print the telerik report from command line instead of using the
Print icon provided on Reportviewer toolbar. Please let me know if it is possible to
print telerik report from command line.

Thank you,
Anita.

anita T
Top achievements
Rank 1
 asked on 16 Nov 2009
4 answers
193 views
Hi,

I'm trying to make subreports visible programmatically with a parameter in the _NeedDataSource event.  This is the code I am using:

            foreach (string filterRow in showHide) 
            { 
                switch(filterRow) 
                { 
                    case "10": 
                        this.textBoxEventTotals.Visible = true
                        this.subReportCommunityEventTotals.Visible = true
                        this.subReportCommunityEventTotals.Report.Visible = true
                        break; 
                    case "20": 
                        this.textBoxEventTotalsByDate.Visible = true
                        this.subReportCommunityEventTotalsByDate.Visible = true
                        this.subReportCommunityEventTotalsByDate.Report.Visible = true
                        break; 
                    case "30": 
                        this.textBoxTotalsByCommunity.Visible = true
                        this.subReportCommunityEventTotalsByCommunity.Visible = true
                        this.subReportCommunityEventTotalsByCommunity.Report.Visible = true
                        break; 
                    case "40": 
                        this.textBoxCommunityAndDate.Visible = true
                        this.subReportCommunityEventsByCommunityAndDate.Visible = true
                        this.subReportCommunityEventsByCommunityAndDate.Report.Visible = true
                        break; 
                    case "50": 
                        this.textBoxDetails.Visible = true
                        this.subReportCommunityEventDetails.Visible = true
                        this.subReportCommunityEventDetails.Report.Visible = true
                        break; 
                } 
            } 
        } 
 

The visibility of everything is set to false.  I don't seem to be able to get to the inner report of my subreport controls. Changing the visiblity of the subreport controls and text boxes works fine.  What am I doing wrong?

I know it sounds a little strange but in the subreport I was going to bail out of getting the data if the subreport wasn't visible.  That's why I want to make the subreport invisible not just the subreport control....

Thanks,
Darren
Darren
Top achievements
Rank 1
 answered on 16 Nov 2009
0 answers
128 views
Hi,
I'm using version 2009 Q3 to create a report and render it as a PDF file.
The report has a table on it. Below that table is a sub report.
In the designer the sub report is straight below the table, but in run time the sub report starts on a new page.
I've set Keep together to false on both the sub report and on the table. I also set page breaks to None, but still this happens.
Is there a way to get the sub report on the same page the table is?
Naphtali
Naphtali
Top achievements
Rank 1
 asked on 16 Nov 2009
1 answer
1.0K+ views
Hello,

Please could somebody point me in the direction of sample code for this? I want my users to be able to select a command link or button from an asp.net page which will download a report straight to PDF.

Many thanks, Carl
Steve
Telerik team
 answered on 16 Nov 2009
1 answer
747 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
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?