Telerik Forums
Reporting Forum
0 answers
83 views
In my telerik report (which was originally designed to display as PDF), I have added the renderformat as HTML if a property is set to true. In the Render method inside the designer class, I check whether the property is true. If true, I make the Page footer section visibility as false before invoking -

 

 

processor.RenderReport(reporter.RenderFormat,this, null).DocumentBytes;

 

(reporter.RenderFormat will be either PDF or HTML. This is also set based on the above said property)
So when I view it as HTML (I convert the byte array as given below:
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 
lblRecordContent.Text = enc.GetString(value);

 

 ),
I have two problems.

1. Page footer section is still shown which is not required in case of HTML view.

 


2. I get a javascript error
   
<script type="text/javascript">
var PageInfo = [%PageNumber%, %PageCount%];
var BookmarksOnPage = new Array(%BookmarksOnPage%);
</script>

Kindly help me on these issues.

Thanks
George
Top achievements
Rank 1
 asked on 04 Aug 2011
1 answer
346 views
Hello,

Does anyone know a link to download a sample? The link in this post http://www.telerik.com/community/forums/preview-thread/reporting/telerik-reporting/reportviewer-silverlight-example-project.aspx not works. I use the version Q3 2010 and there aren't this examples: Start - > Programs -> Telerik -> Reporting -> Visual Studio Examples

Can anyone help me? Please.
I would like to see the Xaml and CodeBehind.

Or can anyone help me to fill the Report on ReportViewer? I didn't understand.

ReportViewer:

<Telerik_ReportViewer_Silverlight:ReportViewer Margin="8" ReportServerUri="../ReportService1.svc" Name="myReportView" Report="Telerik.Reporting.ClassLibrary1, ClassLibrary1.Report1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>



Thanks
Thiago Ferreira
Top achievements
Rank 1
 answered on 03 Aug 2011
2 answers
770 views
I have created a few reports.  Each report has 1 or 2 charts and nothing else.  Using the same steps as in the video as below, I cannot get my reports to show in my Win Form.

http://tv.telerik.com/watch/reporting/video/using-one-report-aspnet-winforms-and-silverlight

I get this error in my reportviewer: Value cannot be null.  Parameter name: key

If I go to my report and click on the Preview tab, it works fine.  Why I can't see it under Win Form?
Peter
Telerik team
 answered on 03 Aug 2011
1 answer
41 views
Hi All,

Apologies for the simplistic title here!

I was just wondering conceptually whether from a rendering efficiency perspective, what is the best route for a report containing a relatively large amount of data between the following two options (Assuming a 1000 item dataset for the purposes of illustration):

A) 100 pages with 10 records per page
B) 10 pages with 100 records per page

I appreciate that the type of report may be a part of the answer, so for this example my report simply has 4-5 fields per record. The details section of the report simple has a header which lists the title of the record and 3-4 fields within the detail section to display the record details.

No images, calculations, charts, or anything else fancy are used, I simply wondered if anyone had any info on how the renderer 'should' respond to these two situations,

Many thanks,

Doug
Peter
Telerik team
 answered on 03 Aug 2011
1 answer
103 views
Hi.

Im making an invoice report and i want a summary of all projects on that invoice at the beginning of the repport ordered by project name.
You could call it a summary list of all projects. I only get the data from the latest project, not all of them. I tried with a table, list and cross table but i dont get out any data.

Underneath i got a group section with all projects, articles and workdates and this works perfectly.

Here is the code i use to set the datasource:

     var invoice = InvoiceRepository.GetInvoiceById(226);


            var query = from w in invoice.WorkHours
                        select new
                                   {
                                       Hours = w.BillableHours ?? w.Hours,
                                       Period = string.Format("{0:yyyy-MM-dd} - {1:yyyy-MM-dd}", w.Invoice.StartDate, w.Invoice.EndDate),
                                       WorkDate = w.WorkSpecification.WorkDate,
                                       Consultant = w.WorkSpecification.User.FirstName + " " + w.WorkSpecification.User.LastName,
                                       ClientName = w.WorkSpecification.Project.Client.ClientNameLegal,
                                       CompanyName = w.WorkSpecification.User.Company.CompanyName,
                                       ArticleName = w.Article.ArticleName,
                                       ProjectName = w.WorkSpecification.Project.ProjectName,
                                       InvoiceTag = w.Invoice.InvoiceTag,
                                       InvoiceUrl = w.Invoice.InvoiceURL,
                                       InvoiceNo = w.Invoice.InvoiceNo,
                                       PricePerHour = w.Article.Prices.Single(p => p.StartDate <= w.WorkSpecification.WorkDate && (p.EndDate ?? DateTime.MaxValue) >= w.WorkSpecification.WorkDate).PricePerHour,
                                       YourReference = w.WorkSpecification.Project.ClientContactName,
                                       ContryZipAndCity = string.Format("{0}-{1} {2}", w.WorkSpecification.User.Company.CountryCode, "", ""),
                                       OurReference = "",
                                       CompanyAdress = "1",
                                   };


            return query.ToList();

Please help me. Ive been working on this for 3 days and im quite a good developer but this thing just breaks me.

Best regards Stefan Åberg.
Peter
Telerik team
 answered on 03 Aug 2011
2 answers
91 views
In a Silverlight app I have a ListBox which is populated using the results of the ListAvailableReports service method(available from the report service).
The method's result is an IList<ReportInfo>.
The class ReportInfo has 3 properties:
Name - contains the report Class name in the Report Library,
FullName - contains the full assembly name,
and
Description.

Obviously I cannot use the firs two, for the user to identify the Report.
My question is: How do I populate the Description property? (What property do I need to set in the Report class on the server ?)
I've looked for some time, but i cannot find it.

Ty for your time,
Alex.

Edit: I use the Reporting 2011 Q2.
Alex
Top achievements
Rank 2
 answered on 03 Aug 2011
0 answers
119 views
Hi, I know there are already some people have discussed about this issue. However, I am getting this error intermittently and couldn't manage to reproduce the error. Can anyone point out what's wrong with the code? The ChartReport is created on the fly and inserted to the main report. It throws the 'Parameter is invalid' when trying to set the value of picture box. Thanks in advance.


public partial class ChartReport : Telerik.Reporting.Report
    {
        public ChartReport(ImageReport chart, string chartTitle, string reportName)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //  
                using (MemoryStream ms = new MemoryStream(chart.Image))
                {
                    ms.Seek(0, SeekOrigin.Begin);
                    Image img = Image.FromStream(ms);
                    Image img2 = CopyImage(img);

                    pcb_Chart.Value = img2; //This line throws the Parameter is invalid error when the value of the picture box control is set
                    txt_ChartTitle.Value = chartTitle;
                }
            this.Name = reportName;
        }

        private Image CopyImage(Image original)
        {
            Image ret = new Bitmap(original.Width, original.Height);
            using (Graphics g = Graphics.FromImage(ret))
            {
                g.DrawImage(original, 0, 0, original.Width, original.Height);
                g.Save();
            }
            return ret;
        }
    }
Kyle
Top achievements
Rank 1
 asked on 03 Aug 2011
1 answer
392 views
I have a crosstab in my report that needs dynamic columns so I am building the groups/rows/columns in the NeedDataSource method.  To get me started, I set up the crosstab in the designer with 2 columns and bind it to a datatable.  The Crosstab displays the data correctly.  Then I reviewed the designer code, and add the groups/rows/columns exactly how it is done in the designer.  Note:  at this point, I am still just adding the 2 columns, so the crosstab should be exactly the same as when built in the designer.  But when I bind the crosstab to the same datatable, it throws an "Index was out of range...." exception.  Since the groups/rows/columns should be the same as when built in the designer, I could be missing a step prior to adding the groups/rows/columns.  Currently, I am clearing all RowGroups, ColumnGroups, Body.Columns, Body.Rows, and Items from the crosstab.  (then adding the rows/columns/groups)  Is there anything else I need to do?  Do you have any other ideas on what might cause the "Index was out of range..." exception?  Here is my code:
crosstab1.RowGroups.Clear();
crosstab1.ColumnGroups.Clear();
crosstab1.Body.Columns.Clear();
crosstab1.Body.Rows.Clear();
crosstab1.Items.Clear();
crosstab1.Corner.ClearCellContent();
 
crosstab1.Body.Columns.Add(new TableBodyColumn(new Unit(2D, UnitType.Inch)));
crosstab1.Body.Columns.Add(new TableBodyColumn(new Unit(2D, UnitType.Inch)));
crosstab1.Body.Rows.Add(new TableBodyRow(new Unit(0.26D, UnitType.Inch)));
 
TextBox txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.Jun2011" };
crosstab1.Items.Add(txtBx);
crosstab1.Body.SetCellContent(0, 0, txtBx);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.Jul2011" };
crosstab1.Items.Add(txtBx);
crosstab1.Body.SetCellContent(0, 1, txtBx);
 
TableGroup group1 = new TableGroup();
group1.Groupings.Add(new Telerik.Reporting.Data.Grouping("=\'ColumnGroup\'"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "June 2011" };
crosstab1.Items.Add(txtBx);
group1.ReportItem = txtBx;
 
TableGroup group2 = new TableGroup();
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "July 2011" };
crosstab1.Items.Add(txtBx);
group2.ReportItem = txtBx;
 
 
crosstab1.ColumnGroups.Add(group1);
crosstab1.ColumnGroups.Add(group2);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "Project Name" };
crosstab1.Items.Add(txtBx);
crosstab1.Corner.SetCellContent(0, 0, txtBx);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "Type Of Financial" };
crosstab1.Items.Add(txtBx);
crosstab1.Corner.SetCellContent(0, 1, txtBx);
 
 
TableGroup group4 = new TableGroup();
group4.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields.TypeOfFinancial"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.TypeOfFinancial" };
crosstab1.Items.Add(txtBx);
group4.ReportItem = txtBx;
group4.Sortings.Add(new Telerik.Reporting.Data.Sorting("=Fields.TypeOfFinancial", Telerik.Reporting.Data.SortDirection.Asc));
 
 
TableGroup group3 = new TableGroup();
group3.ChildGroups.Add(group4);
group3.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields.ProjectName"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.ProjectName" };
crosstab1.Items.Add(txtBx);
group3.ReportItem = txtBx;
 
crosstab1.RowGroups.Add(group3);
 
crosstab1.DataSource = ConstructDataTable();

Justin Lee
Top achievements
Rank 1
 answered on 02 Aug 2011
3 answers
141 views

I have a senario similar to this:

class CarManufacture
{
    String Name { get; set; }
    String Description { get; set; }
   List<Model> CarModels { get; set; }
   List<Model> TruckModels { get; set; }
}
 
class Model
{
   string ModelName { get; set; }
}


The list of Manufactures will be the datasource, and it won't be a fixed count.  What I want to do is show the Manufactures horizontally, and below them, the lists of cars and trucks.  So something like this:

                Chevrolet            Ford                Nissan
                [Description]        [Discription]    [Description]

Cars        Malibu                Mustang           Altima
                Impala                Fusion              Maxima
                Camaro                                       Versa

Trucks     Colorado            F150                Titan
                Silverado            F250
            

How can I accomplish this?  I'm trying with a CrossTab, but can't quite figure it out.  Are there any examples of something like this?



Justin Lee
Top achievements
Rank 1
 answered on 02 Aug 2011
2 answers
672 views
Hello,

In my code I assign the string "HIGH" to a TextBox in my Report. The report shows the value "HIGH" correctly in the report. I would like to format the TextBox in such a way that the text's colr is Red when it contains "HIGH". Therefore I have created a Conditional Formatting Rule saying  that if TextBoxName.Value = ="HIGH" (see attached image) the the style should have a red font color.

However this does not work. Dies conditional formatting work if the value of the textbox is assigned directly through code?

Any help is appreciated.

Thanks in advance
Ionel
Top achievements
Rank 1
 answered on 02 Aug 2011
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?