Telerik Forums
Reporting Forum
3 answers
289 views

I need to create a report programicly.  if i have a text box and that will be filled with the Text "foobar" at Arial 10 bold.  how do i calculate the length.  Below is what i need to achieve.   is there a way to calculate the length to place in the code below without guessing..  

 

 

new

 

 

Telerik.Reporting.Drawing.Unit(0.800000011920929D, Telerik.Reporting.Drawing.UnitType.Inch)

 

Squall
Top achievements
Rank 1
 answered on 31 May 2011
8 answers
1.0K+ views

I just upgraded Telerik Reporting to Q3 2009 (version 3.2.9.1211), and now I receive an error whenever I try to open a report in design mode in Visual Studio 2008:

 

Type 'Telerik.Reporting.Drawing.Unit' does not have a constructor with parameters of types Double, UnitType.

 

Granted, I am new to Telerik Reporting, but the code hasn’t changed, and it still works fine with Telerik Reporting Q2 2009.  It looks to me like the new version still does have a constructor with that signature, and my reports do indeed compile and run just fine.  Unfortunately, I can’t open them to edit them.

 

This is the call stack it gives me:

 

at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

 

I tried the "Ignore and Continue" option, but that just gives me another error.  Does anyone have any clue as to what I may have done wrong, or what I can do to correct this problem?  Thank you very much.

Shaun

richard
Top achievements
Rank 1
 answered on 31 May 2011
1 answer
54 views
Hi,

I have followed the online tutorial/video to create a report and embed it within my Silverlight project. This works fine when running under the Visual Studio Development Server and the report displays (Only displaying static text for now). As soon as I change it run on the local IIS server (IIS 7.5), the report simply displays "Object reference not set to an instance of an object." I am able to access the report service from the web browser and that is working fine.

If I then switch it back to the VSDS, it works again.

Any ideas?

Regards,
Drew
IvanDT
Telerik team
 answered on 31 May 2011
3 answers
81 views
I have an application where we would like to combine several individual reports into one master report.

I created all six of the sub-reports, and they each have specific report header sections which describe the content.

When embedding these reports, I need to suppress the display of the report header.

I am thinking I can either make that section invisible by default, and then change to visible when the report runs all by itself.

Or the opposite, making the header invisible when I detect that the report is contained inside a parent report.

Question #1: is there a way within the sub-port code to determine if there is a "parent"?

Question #2: is there a way to access the sub-report header setting (visibility) from within the code of the master report?

As an example, in another thread I learned how to set properties in the main report. I am lacking in the knowledge of how to dig deeper into the content of the subreports. In effect, "....some kind of cast....some report property.....find something or other inside subreport1..."

Dim report As Telerik.Reporting.Report = DirectCast(Me.ReportViewer1.Report, Telerik.Reporting.Report)
Dim txt As Telerik.Reporting.HtmlTextBox = TryCast(report.Items.Find("filter_description", True)(0), Telerik.Reporting.HtmlTextBox)
txt.Value = HttpContext.Current.Session("grid_title")
Peter
Telerik team
 answered on 31 May 2011
3 answers
224 views
I'm passing parameters as stated in: http://www.telerik.com/support/kb/reporting/report-viewers/programmatic-initialization-of-report-parameter-values-in-telerik-reporting-silverlight-viewer.aspx

public PrintReport()
        {
            InitializeComponent();
            this.ReportViewer1.RenderBegin += new Telerik.ReportViewer.Silverlight.RenderBeginEventHandler(ReportViewer1_RenderBegin);
        }
void ReportViewer1_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
{
    args.ParameterValues["ObjectTypeId"] = 40;
    args.ParameterValues["Page"] = 1;
    args.ParameterValues["PageSize"] = 10;
}


And trying to grab them in the server this way, but I get only null values. which is the correct way to do this ?

public partial class ObjectInstancesReport : Telerik.Reporting.Report
{
public ObjectInstancesReport()
{
                        InitializeComponent();

var objectTypeId = this.ReportParameters["ObjectTypeId"].Value == null ? 40 : (int)this.ReportParameters["ObjectTypeId"].Value;
var searchText = (string)this.ReportParameters["SearchText"].Value;
var page = this.ReportParameters["Page"].Value == null ? 1 : (int)this.ReportParameters["Page"].Value;
var pageSize = this.ReportParameters["PageSize"].Value == null ? 20 : (int)this.ReportParameters["PageSize"].Value;
Ed
Top achievements
Rank 1
 answered on 31 May 2011
1 answer
88 views
Gents, ...

Although the installer finishes and indicates success, the installation in not completed properly.  Not items are added to the toolset.  No addition to the telerik menu correlating to the reporting module is installed. 

There is an icon in the general C# are for Q1 2011 reports, but on trying to use it a failure is produced (image attached).

Can you please advise how I may get some assistance in installation so as to "try before buy".

Many thanks,
Mark Tompkins
Steve
Telerik team
 answered on 31 May 2011
1 answer
80 views
Hi,
We are new to Telerik reports and try to solve a specific problem.

We have a Dictionary of variables in  the form of: key="Name" value = "Jack", key="height", value =1.90.
Is it possible to display these values on a report?
Peter
Telerik team
 answered on 30 May 2011
2 answers
99 views
Hi there,

We have set up may reports that are all working fine but have an issue with formatting....

Each report has been formatted so that when data is output to 'grid' type layout - using the detail section - we place a border around each text box to provide a simple layout that clearly shows all lines and columns of the report.

The borders are set using the properties toolbar and not via code.

Everything works fine when we run it in Preview mode - all formatting is correct.

But when the report is viewed in HTML mode any empty text boxes that have no value have no formatting - so no borders at all.

I have tried adding a Conditional Formatting rule to the boxes but this does not work either.

Its a weird one as we have managed to create may reports but cannout publish them for clients as when there is no data in a box it applies no formatting and as such the report looks terrible.

Can you help?

Thanks in advance.
Geoff
Top achievements
Rank 1
 answered on 30 May 2011
7 answers
958 views

Hi,

I am trying to build a report programmatically without using the wizard. In this report am using parameter which also should be done programmatically according to my data, and through a query that also be added.

 

I tried this >> http://www.telerik.com/help/reporting/programmatic-creating-report.html

 

But I don’t know why am getting and empty report?!

 

Also the parameters and filter?!

 

Is there is any procedures behind that


this is a part of what i did, i might be missing something,, lemme know please?
Thanks in advance

Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
Imports System.Data.SqlClient
  
Partial Public Class Visitreport
    Inherits Telerik.Reporting.Report
    Public Sub New()
        InitializeComponent()
        Dim report As New Report()
        'Dim sql As String = "SELECT  "
        Dim sql As String = ""
        Dim connectionString As String = ""
        Dim adapter As New SqlDataAdapter(sql, connectionString)
        report.DataSource = adapter
        'creating item programatically 
        Dim detail As New DetailSection()
        Me.detail.Height = New Telerik.Reporting.Drawing.Unit(3, Telerik.Reporting.Drawing.UnitType.Inch)
        Me.detail.Name = "detail"
        report.Items.Add(DirectCast(detail, ReportItemBase))
  
        Dim panel1 As New Telerik.Reporting.Panel()
        Dim textBox1 As New Telerik.Reporting.TextBox()
  
        'panel1
  
  
        panel1.Location = New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm))
        panel1.Size = New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(8.5, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(3.5, Telerik.Reporting.Drawing.UnitType.Cm))
        panel1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
  
        'textBox1
  
  
        textBox1.Location = New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm))
        textBox1.Name = "NameDataTextBox"
        textBox1.Size = New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(0.6, Telerik.Reporting.Drawing.UnitType.Cm))
        textBox1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
        textBox1.StyleName = "Data"
        textBox1.Value = "=Fields.AssignTo"
  
        panel1.Items.AddRange(New Telerik.Reporting.ReportItemBase() {textBox1})
        detail.Items.AddRange(New Telerik.Reporting.ReportItemBase() {panel1})
  
        Dim reportParameter1 As New Telerik.Reporting.ReportParameter()
        reportParameter1.Name = "Parameter1"
        reportParameter1.Text = "Enter Value for Parameter1"
        reportParameter1.Type = Telerik.Reporting.ReportParameterType.Integer
        reportParameter1.AllowBlank = False
        reportParameter1.AllowNull = False
        reportParameter1.Value = "=10"
        reportParameter1.Visible = True
        report.ReportParameters.Add(reportParameter1)
        reportParameter1.AvailableValues.DataSource = adapter
        reportParameter1.AvailableValues.ValueMember = "= Fields.AssignTo"
        reportParameter1.AvailableValues.DisplayMember = "= Fields.AssignTo"
        Dim filter1 As New Telerik.Reporting.Data.Filter()
        filter1.Expression = "=Fields.AssignTo"
        filter1.Operator = Telerik.Reporting.Data.FilterOperator.Equal
        filter1.Value = "=Parameters.AssignTo"
        reportParameter1.AvailableValues.Filters.AddRange(New Telerik.Reporting.Data.Filter() {filter1})
        Dim sorting1 As New Telerik.Reporting.Data.Sorting()
        sorting1.Expression = "=Fields.AssignTo"
        sorting1.Direction = Telerik.Reporting.Data.SortDirection.Asc
        reportParameter1.AvailableValues.Sortings.AddRange(New Telerik.Reporting.Data.Sorting() {sorting1})
  
  
        '   report.ReportParameters("AssignTo").Value = ""
  
    End Sub
  
    Private Sub detail_ItemDataBound(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles detail.ItemDataBound
        'Take the Telerik.Reporting.Processing.Report instance
        'Dim report As Telerik.Reporting.Processing.Report = DirectCast(sender, Telerik.Reporting.Processing.Report)
  
        ' Transfer the value of the processing instance of ReportParameter
        ' to the parameter value of the sqlDataSource component
        '   Me.SqlDataSource1.Parameters(0).Value = report.Parameters("AssignTo").Value
  
        ' Set the SqlDataSource component as it's DataSource
        report.DataSource = Me.SqlDataSource1
  
    End Sub
End Class
veena
Top achievements
Rank 1
 answered on 29 May 2011
2 answers
780 views

Hi,,..

I had added a parameter, however am not able to build the datasourse object

 

I do not want to use the sqldatasourse control, so how can I build it to get the data from the parameter I create.

How to bind the data to it

 

I use this code to build the parameter



Dim reportParameter1 As New Telerik.Reporting.ReportParameter()
        reportParameter1.Name = "Parameter1"
        reportParameter1.Text = "Category"
        reportParameter1.Type = Telerik.Reporting.ReportParameterType.String
        reportParameter1.AllowBlank = False
        reportParameter1.AllowNull = False
        reportParameter1.Value = "= Fields.Category"
        reportParameter1.Visible = True
        Report.ReportParameters.Add(reportParameter1)
  
reportParameter1.AvailableValues.DataSource = objectDataSource1
        reportParameter1.AvailableValues.ValueMember = "= Fields.Category"
        reportParameter1.AvailableValues.DisplayMember = "= Fields.Category"

Furthermore, I wanna bind this parameter to a objectdatasourse,,so I found this code but I could not use it


Public Sub HowToObjectDataSourceParameters()
    Dim objectDataSource1 As New Telerik.Reporting.ObjectDataSource()
    objectDataSource1.DataMember = "GetCars"
    objectDataSource1.DataSource = GetType(Cars)
    objectDataSource1.Parameters.Add(New Telerik.Reporting.ObjectDataSourceParameter("year", GetType(Integer), 2010))
    objectDataSource1.Parameters.Add(New Telerik.Reporting.ObjectDataSourceParameter("color", GetType(String), "=Parameters.Color"))
End Sub

objectDataSource1.DataSource = GetType(Cars)<>>>> what is Cars? <<>>what do they mean by this type,, i did not get it.

Thanks in advance
Anoop
Top achievements
Rank 1
 answered on 29 May 2011
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?