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

An error has occured while processing TextBox 'textBox1':

1 Answer 523 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
nishant mehta
Top achievements
Rank 1
nishant mehta asked on 14 Nov 2009, 06:09 PM
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?

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Nov 2009, 09:17 AM
Hello nishant mehta,

First we would like to ask, why you've taken out code from the InitializeComponent() method and placed it in the report constructor? The Report Designer does a great deal of work to simplify common tasks, so that you do not have to deal with the underlying code, which is not always trivial.
In this line of thoughts, if you have used the designer to add the desired fields, then the Value for the textbox would be proper, namely:

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

The "[]" brackets are used only for the database column name whenever there is a space. Using it to "wrap" the whole expression is simply wrong.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
nishant mehta
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or