Telerik Forums
Reporting Forum
1 answer
1.0K+ views

Hello,

 

I need to create a report programmatically and watch this report in a report viewer when i push a button for print this. I have read information but i can't resolve it. This is my code:

 

 

protected void Page_Load(object sender, EventArgs e)
   {
       doReport();
   }
 
   private void doReport()
   {
       DataTable table = new DataTable();
       table.Columns.Add("Col1", typeof(string));
       table.Columns.Add("Col2", typeof(string));
       table.Columns.Add("Col3", typeof(string));
       table.Columns.Add("Col4", typeof(string));
 
       List<datos> datosList = new List<datos>();
       datosList.Add(new datos { dato1 = " lala", dato2 = "lele", dato3 = "lili", dato4 = "lolo" });
       datosList.Add(new datos { dato1 = " lala", dato2 = "lele", dato3 = "lili", dato4 = "lolo" });
       datosList.Add(new datos { dato1 = " lala", dato2 = "lele", dato3 = "lili", dato4 = "lolo" });
       datosList.Add(new datos { dato1 = " lala", dato2 = "lele", dato3 = "lili", dato4 = "lolo" });
 
       for (int i = 0; i < datosList.Count; i++)
       {
           string dato1 = datosList[i].dato1;
           string dato2 = datosList[i].dato2;
           string dato3 = datosList[i].dato3;
           string dato4 = datosList[i].dato4;
           table.Rows.Add(dato1, dato2, dato3, dato4);
       }
 
       Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
       objectDataSource.DataSource = table;
       objectDataSource.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("FullName", typeof(string), "=Fields.PagePath + ' ' + Fields.Pageviews")); // Adding a sample calculated field.
 
 
       Telerik.Reporting.Report report = new Telerik.Reporting.Report();
       report.Name = "prueba";
       report.DocumentName = "prueba";
       report.DataSource = objectDataSource;
 
       Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
       reportSource.ReportDocument = report;
 
       ReportViewer1.ReportSource = reportSource;
 
       ReportViewer1.RefreshReport();
   }
 
   public class datos
   {
       public datos()
       {}
 
       public string dato1 ;
       public string dato2 ;
       public string dato3 ;
       public string dato4 ;
   }

 

Any idea? Thanks

Stef
Telerik team
 answered on 15 Jun 2015
3 answers
299 views
Hello Support,

I trying using Telerik Reporting tools, I have a report as you see in attachment.
My report is simple read a data from database and fill the text boxes but I face a problem when the textbox has multi lines the textbox did not push down other controls I set the properties CanGrow=True, MultiLine=True and Anchor=Top

I am using ASP.NET 4.5 ,SQL DataSourc and RenderReport to pdf becouse I want to generate the report on the server and save it in database

Please give me your advice

Best Regards
Abdullah
Top achievements
Rank 1
 answered on 15 Jun 2015
1 answer
105 views

Here I am using graph control for showing more that 25 records, If record is less than 10 dynamically populate according to condition then graph is showing properly other wise graph is overlap. 

 

Any one have any idea which properties fulfill this requirement.

Nasko
Telerik team
 answered on 15 Jun 2015
18 answers
1.1K+ views
Hello,

I'm creating a multicolumn report where i need to display pictures related to an item.
Let's say the item have 5 different pictures and i need to display 3 pictures per row.

Her's my example on how i wish to display pictures of the item:
Column1             Column2             Column3
Image1.gif            Image2.gif            Image3.gif         
Image4.gif            Image5.gif            

So i set up the number of column (ColumnCount) to 3 for the detail section. 
But the only problem i found is the report won't display the pictures in the way i want. The report start displaying pictures column by column. And, if these 5 pictures doesn't fit in one column then the report will fill the 2nd column and so on...

Here's the output of the report:
Column1             Column2             Column3
Image1.gif            Image5.gif
Image2.gif            
Image3.gif            
Image4.gif            

So my whole target is to have a way to diplay my picture in an horizontal way (as shown in the example above) and not in vertical way.

Does anyone have an idea on how to fix my problem ?
Thank you.

Paul
IamSalik
Top achievements
Rank 1
 answered on 15 Jun 2015
7 answers
299 views
I tried changing the column count of the details section to 2. No matter how i change the width and it's contents, my report shows in only one column. Any idea whether I'm missing to do something?

Thanks !

Nasko
Telerik team
 answered on 15 Jun 2015
1 answer
701 views

Dear all,

I have a table that is displayed in multiple pages. The Problem is the group footer of the table is only displayed in the last page. Is there any way to display the
group footer in each page?

Thanks indeed for your advice.

Regards,

A.

 

Stef
Telerik team
 answered on 12 Jun 2015
7 answers
1.0K+ views

Hello, We have working HTML5 Report viewer with back-end WCF servics. 

Now , we are looking for additional step ahead where we can generate the report programmatically and send it over as email attachment.

I have followed the article "Exporting Report Programmatically" & able to create the report programmatically, however when I am assigning the data to report source it goes as NULL.
            ReportViewer1.ReportSource = reportSource;

The serveic returns valid data in Telerik.Reporting.ObjectDataSource but it goes as NULL while assigning it to Report viewer. 
Any thoughts, what could be wrong here ?

topSpendersDataList = BusinessManager.GetTopSpenders();
 
      Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
      objectDataSource.DataSource = topSpendersDataList; // GetData returns a DataSet with three tables
      objectDataSource.DataMember = "GetTopSpenders"; // Indicating the exact table to bind to. If the DataMember is not specified the first data table will be used.
            objectDataSource.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("FirstName", typeof(string), "=Fields.firstName")); // Adding a sample calculated field.
            objectDataSource.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("LastName", typeof(string), "=Fields.lastName"));
 
            // Creating a new report
            Telerik.Reporting.Report report = new Telerik.Reporting.Report();
 
            // Assigning the ObjectDataSource component to the DataSource property of the report.
            report.DataSource = objectDataSource;
 
            // Use the InstanceReportSource to pass the report to the viewer for displaying
            Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
            reportSource.ReportDocument = report;
 
            // Assigning the report to the report viewer.
            ReportViewer1.ReportSource = reportSource;

Thanks,

Nitin

Stef
Telerik team
 answered on 12 Jun 2015
2 answers
464 views

Hi, I created a report that gas one group. The data has the following form:

OrderID | Date | OrderTotal | InvoiceID | InvoiceTotal

1 | 2015-01-01 | 300 | 1 | 150

1 | 2015-01-01 | 300 | 2 | 100

1 | 2015-01-01 | 300 | 3 | 50

 

The report groups on OrderID, so on the group header I have the info related to the order and on the detail section I have the info related to the invoices for each order. The group footer has a subtotal for the InvoicoTotal (this works fine. Returns value of 300). In the report footer I have a total for OrderTotal, and teh prblem here is that the value I am getting is 900 instead of 300. How can I achieve to sum on the group level and not on the detail level. I have already tried using Exec(scope, SUM) and RunningTotal(scope, SUM) but the result is the same.

Javier Gonzalez de Aragon
Top achievements
Rank 2
 answered on 12 Jun 2015
2 answers
381 views

I am using Telerik Report Designer, and I have a report that has many nested subreports. The report works fine, but I am trying to change one subreport based on user input.  I attempted to do this by adding a Binding to ReportSource like this:

 

= IIf(Parameters.Images.Value,"ShowImages.trdx", "NoImage.trdx")

When I run this I get the error

 

I've tried different variations of the Expression, including the full path of the trdx file,  but get the same error. Is there a way to change which file is referenced?

 

Thanks,

Tracy

Tracy
Top achievements
Rank 1
 answered on 11 Jun 2015
1 answer
253 views

I am having an issue getting my report to layout correctly.

Each item in the report has a header and a body textbox.

I have it set to layout 2 items per page. But if the body textbox grows beyond its initial size I need it to set PageBreak to beforeandafter to isolate the report.

I tried putting a binding on the main section, but am not able to access the body textbox properties in it.

Is there another way this can be accomplished?

Stef
Telerik team
 answered on 11 Jun 2015
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?