I'm using an objectdatasource, and I'd like to bind the length of a Horizontal Line Shape to a member of that objectdatasource. I've tried returning a string, int and double but get errors like
that below. Is it possible to do this?
An error has occurred while processing Shape 'shape1': Bindings error - An error occurred while invoking the setter on property 'Width' with value '0.11in'
9 Answers, 1 is accepted
0
YARARMAN
Top achievements
Rank 1
answered on 13 Dec 2012, 12:37 PM
Use it:
shape1.Width = Telerik.Reporting.Drawing.Unit.In(0.11);
or
shape1.Width.Value = 0.11;
0
Joe
Top achievements
Rank 1
answered on 13 Dec 2012, 02:43 PM
Is it possible to do this binding the property to the object?
0
YARARMAN
Top achievements
Rank 1
answered on 13 Dec 2012, 02:55 PM
Which object and its property? TextBox, Shape etc. ?
0
Joe
Top achievements
Rank 1
answered on 13 Dec 2012, 02:57 PM
Width property of a Shape.
0
YARARMAN
Top achievements
Rank 1
answered on 13 Dec 2012, 03:03 PM
Conditional Formatting avaible.
I think, but you can't to change width by it.
Use my code above before Report rendering.
I think, but you can't to change width by it.
Use my code above before Report rendering.
0
Joe
Top achievements
Rank 1
answered on 13 Dec 2012, 03:54 PM
How would I do that? I have an objectDataSource, which is a list of objects, and I want the Width of this shape to represent that property on that particular object.
0
YARARMAN
Top achievements
Rank 1
answered on 13 Dec 2012, 04:30 PM
Browse below project.
Developed in VS 2012.
Create a new Telerik Report Item to your Project.
Add a TextBox as name as name 'txtControl' to your Report.
Binding Class is a ObjectData.
frmMain.cs
Developed in VS 2012.
Create a new Telerik Report Item to your Project.
Add a TextBox as name as name 'txtControl' to your Report.
Binding Class is a ObjectData.
frmMain.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.Reporting;
namespace WindowsTelerikSimpleReportBinding
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnLoadReport_Click(object sender, EventArgs e)
{
Binding _Binding = new Binding();
_Binding.Data = "New Data";
ReportControl _ReportControl = new ReportControl();
_ReportControl.Value = "New Value!";
_ReportControl.Height = 5;
_ReportControl.Width = 60;
_ReportControl.Left = 40;
_ReportControl.Top = 10;
_ReportControl.Visible = true;
Telerik.Reporting.Report mainReport = new rprSample();
SetReportControls(ref mainReport, _ReportControl);
InstanceReportSource instanceReportSource = new InstanceReportSource();
mainReport.DataSource = _Binding;
instanceReportSource.ReportDocument = mainReport;
rprViewer.ReportSource = instanceReportSource;
rprViewer.RefreshReport();
}
private void SetReportControls(ref Telerik.Reporting.Report invoice, ReportControl rc)
{
if (invoice != null)
{
Telerik.Reporting.TextBox _TextBox = (Telerik.Reporting.TextBox)invoice.Items.Find("txtControl", true).SingleOrDefault();
if (_TextBox != null)
{
_TextBox.Height = Telerik.Reporting.Drawing.Unit.Mm(rc.Height);
_TextBox.Width = Telerik.Reporting.Drawing.Unit.Mm(rc.Width);
_TextBox.Left = Telerik.Reporting.Drawing.Unit.Mm(rc.Left);
_TextBox.Top = Telerik.Reporting.Drawing.Unit.Mm(rc.Top);
//_TextBox.Value = rc.Value;
_TextBox.Visible = rc.Visible;
}
}
}
public class Binding
{
private string _Data;
public string Data
{
get { return _Data; }
set { _Data = value; }
}
}
public class ReportControl
{
private string _Value;
public string Value
{
get { return _Value; }
set { _Value = value; }
}
private double _Height;
public double Height
{
get { return _Height; }
set { _Height = value; }
}
private double _Width;
public double Width
{
get { return _Width; }
set { _Width = value; }
}
private double _Top;
public double Top
{
get { return _Top; }
set { _Top = value; }
}
private double _Left;
public double Left
{
get { return _Left; }
set { _Left = value; }
}
private bool _Visible;
public bool Visible
{
get { return _Visible; }
set { _Visible = value; }
}
}
}
}
0
christinecyx
Top achievements
Rank 1
answered on 22 Nov 2016, 07:07 AM
Hello!Could you tell me what is 'rprSample()' ? It comes from this row: Telerik.Reporting.Report mainReport = new rprSample();
0
Hello christinecyx,
The following row creates a new instance of a Telerik Report designed in VS Report Designer:
The report is a type inheriting Telerik.Reporting.Report.
For more details, please check How To: Create a Report (Visual Studio).
Regards,
Stef
Telerik by Progress
The following row creates a new instance of a Telerik Report designed in VS Report Designer:
Telerik.Reporting.Report mainReport =
new
rprSample();
For more details, please check How To: Create a Report (Visual Studio).
Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items