Telerik Forums
Reporting Forum
6 answers
233 views
I have a report like that
groupheader1
    groupheader2
        detail
    groupfooter2
groupfooter1

for some groupheader2, i need a page break page.
I write some code, like that :

 

        private void groupHeader2_ItemDataBinding(object sender, EventArgs e)  
        {  
            Telerik.Reporting.Processing.GroupSection headerAgent = (Telerik.Reporting.Processing.GroupSection)sender;  
            LinqEntityBaseLoan.ComAPayer com = headerAgent.DataObject.RawData as LinqEntityBaseLoan.ComAPayer;  
            headerAgent.Visible = com.Agent_ID != com.SuperAgent_ID;  
            if (headerAgent.Visible)  
                this.groupHeaderAgent.PageBreak = PageBreak.Before;  
            else 
                this.groupHeaderAgent.PageBreak = PageBreak.None;  
        } 

but the result is that in the next printed header, the page break will occur.
I try to change to headerAgent.PageBreak = PageBreak.Before but PageBreak is readonly. It seems that the ..Engine.ReportSection is created before Report.ReportSection (it is normal) and can not be changed (but visible can be !).

After a long search, i created a fake group :
groupheader1
    groupheader2fake
    groupheader2
        detail
    groupfooter2
    groupfooter2fake
groupfooter1

And write the event groupHeader2fake_ItemDataBinding.

Is it normal to proceed like this ? A settable Break Page or an event before the creation of Engine.ReportSection can be usefull !


 

danparker276
Top achievements
Rank 2
 answered on 29 Apr 2011
5 answers
138 views
I appreciate the help in advance!

I have some code here for a chart in my report which resides in the NeedDataSource for the chart.  Everything's working great "except one line" which should change the "stacked bar 100" chart Y labels to percentages (I have four databound series which show fine on the chart otherwise):

 

 

For ThisOne As Integer = 0 To 4

 

 

 

Me.Chart1.Series(ThisOne).Name = Me.ReportParameters("DataTitle" + (ThisOne + 1).ToString).Value

 

 

 

Me.Chart1.Series(ThisOne).Appearance.LabelAppearance.LabelLocation = Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside

 

 

 

Me.Chart1.Series(ThisOne).Appearance.LabelAppearance.Position.AlignedPosition = Charting.Styles.AlignedPositions.Center

 

 

 

Me.Chart1.Series(ThisOne).Appearance.TextAppearance.TextProperties.Color = Color.Black

 

 

 

Me.Chart1.Series(ThisOne).Appearance.Shadow.Blur = 4

 

 

 

Me.Chart1.Series(ThisOne).Appearance.Shadow.Distance = 2

 

 

 

Me.Chart1.Series(ThisOne).Appearance.Shadow.Position = Charting.Styles.ShadowPosition.BottomRight

 

 

 

Me.Chart1.Series(ThisOne).DefaultLabelValue = "#%"

 

 

 

Next

 


I expected from the documentation and forums that the "DefaultLabelValue" line would change the stacked bar labels to percentages but it does not for me.  I can set the DefaultLabelValue property at design time and all looks dandy, however, that property gets wiped out at the time of the NeedDataSource, hence my feeble attempt here to make things right...

Please point me to the errors of my ways so I can wrap up this chart!

Thanks,
Steve
Rose
Top achievements
Rank 1
 answered on 29 Apr 2011
4 answers
257 views
I'm moving session state to "sql mode" but I've some problems with performance in asp.net.

When using "inproc mode" the ReportViewer shows the report after 2.8 secs, while in "sql mode" it takes more de 30 secs. Is this normal?
My report has only one page with some images.

Thanks!
Jorge
Top achievements
Rank 1
 answered on 29 Apr 2011
1 answer
59 views
On the page code file, where is my reporting viewer I use:

XOReportingLibrary.Company.TheCompanyReport CReport = new XOReportingLibrary.Company.TheCompanyReport();
Telerik.Reporting.Report theReport = (Telerik.Reporting.Report)this.ReportViewer1.Report;
theReport.ReportParameters["CompanyName"].Value = "SomeCompanyName";

On the report code file I'm using:

string strCName = this.ReportParameters["CompanyName"].Value.ToString();

but this.ReportParameters["CompanyName"].Value.ToString()... by some reasone is NULL and does not works...
XOReportingLibrary is the name of the library, and TheCompanyReport is the name of the report

P.S.
If you have some simple code please send me!
Steve
Telerik team
 answered on 29 Apr 2011
3 answers
180 views
Hi,

   I need to format the crosstab. I need to change the background of the entire row (row & value field) based on the value of a field. How can it be done?

Thanks in advance.
Steve
Telerik team
 answered on 29 Apr 2011
2 answers
565 views
Hello...

I am attempting to duplicate an Excel report that has a two row header with column spans within those two rows. All the header text is static.

In the detail, have have some rowspans and a few static text cells, the details ends up being 4 rows.

From reading through the docs, it looks as if I need to use a table to accomplish the two row header (I want this header to repeat at the top of each page as well).

I am also binding to an object data source. I have created a wrapper class to simplify binding. It is very similar to the docs using the Car and Cars classes. However, I just want bind my report to a System.Collections.Generic.List<Car> rather than making an unneeded Cars class. However, I run into problems getting my report and table to bind properly so that I can simply show the 4 row detail (remember 4 rows per bound item, this is due to horrible formatting in the original report, sort of a summary table approach for each item).

So, given that I have 8 items bound and lets say only one item fit on a page (due to the large multirow header), I would end up with 8 Pages. Table header on each page, followed by the bound report items (textboxes only) for the current item.

I hope that is a clear explanation of what Im trying to do... now for my questions. :-)

1. How do I set up DataBinding for the report and Table? I tried binding directly to the equivalent Car class and also setting that data source to the table, but that didn't work at all. It seems I have to create an equivalent Cars class to wrap the list only? Seems unneeded tho?

2. When I drag a table onto my report detail I get the standard 3 column table header and table detail. Once I started adding rows and columnns and then merging them, the table looked great but once I previewed, I started getting missing cells. Is there some sort of trick to getting cells added and merged so that they stay in the header? Things really started to get weird in the header when I added multiple rows, in the end, the only header cells that showed up were in the original header row, the row I added above refused to render. If I merged any cells to the top row of the header, the refused to render too.

I attached a screenshot of the report I am trying to make so you can see the messiness. The header is highlighted in Yellow and the bottom 4 rows are repeated *for each* bound item. In the photo, there are two bound items that would be shown in the 8 rows below the header. I had to blur it to protect the content somewhat, but it is still good for layout purposes.

thank you

ja

Im using Reporting Q3 2010 and winforms + ASP in .NET 3.5
Jess Askey
Top achievements
Rank 2
 answered on 28 Apr 2011
4 answers
250 views
When previewing a report I get the following error:

Unable to cast object of type 'SqldataObject' to type 'Telerik.Reporting.Processing.Expressions.IHierarchicalData'

I have narrowed down the problem to a textbox that has

=Sum(Exec("group4",Fields.Amount1))

Any help is appreciated
Steve
Telerik team
 answered on 28 Apr 2011
2 answers
234 views
Hello,

I'm using VS 2008 Q1 2010 Telerik Reporting

I'm attempting to set and bind a Telerik.Reporting.Processing.Table inside of the Detail's detail_ItemDataBound event and I'm running into some trouble.

I currently have a simple table inside my Report's detail. The table has a header and a detail row that repeats.

Originally I was binding the table to a DataTable inside of the DataBind() and having no issues.  After having some trouble getting the table's groupings correct I decided it would be a little more practical move the Telerik.Reporting.Processing.Table binding inside the detail_ItemDataBound event and bind it there with the correct data.  When I move the binding inside the detail_ItemDataBound event I get a blank table with no data.

Below is my code from the detail_ItemDataBound event:
private void detail_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.DetailSection detail = (Telerik.Reporting.Processing.DetailSection)sender;
    Telerik.Reporting.Processing.TextBox txtHierarchicalEntityID = (Telerik.Reporting.Processing.TextBox)detail.ChildElements.Find("txtHierarchicalEntityID", true)[0];
    Telerik.Reporting.Processing.Table tblReport = (Telerik.Reporting.Processing.Table)detail.ChildElements.Find("tblReport", true)[0];
 
    int hierarchicalEntityID = Convert.ToInt32(txtHierarchicalEntityID.Text);
 
    dsReporting dsBindingData = new dsReporting();
 
    foreach (dsReporting.AssessmentResultsChartRow currRow in dsRaw.AssessmentResultsChart.Rows)
        if ((int)currRow["HierarchicalEntityID"] == hierarchicalEntityID)
            dsBindingData.AssessmentResultsChart.ImportRow(currRow);
 
    dsBindingData.AcceptChanges();
 
    tblReport.DataSource = dsBindingData.AssessmentResultsChart;
}

Am I missing anything simple that would keep the tblReport from binding correctly?

Thanks for the help and let me know if you need anything else,
Allen
Allen Smothers
Top achievements
Rank 2
 answered on 28 Apr 2011
1 answer
88 views
I have a bar report that is using the NeedDataSource event to set the datasource and labels. On the initial report load the data is correct but the labels are just 1,2,3,... If I refresh the report I get the correct text labels (AUS Approved, AUS Declined,etc...). I have stepped through the code to verify that the dataset is being populated correctly on the initial load. However, when I get to the line of code that sets any of the series elements I get the following error message:"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index". I am trapping for any errors so the report will load with the correct data but no text for the labels. On a refresh I do not get the error and the label appear correctly. Here is the code for my NeedDataSource event:

private void chart1_NeedDataSource(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Chart procChart = sender as Telerik.Reporting.Processing.Chart;
              
            string sql = @"SELECT COUNT(l.[LookupID]) as 'AUSStatusCnt',l.[ClientLookupValue] as 'AUSStatus' 
                            FROM [AUS] a 
                            INNER JOIN [Organization] o ON a.[OrganizationID]=o.[OrganizationID] 
                            INNER JOIN [Lookup] l ON l.[LookupID] = a.[AUSStatusID] 
                            where  a.[AUSID] in ([dbo].[udf_GetLastAUSStatus](a.[AUSParentID])) 
                            AND a.[OrganizationID]=@OrganizationID AND l.[LookupTypeID]=13 
                            and l.[Active]=1 
                            AND a.[UpdatedByDate] >= DATEADD(d,-90,GETDATE())
                            GROUP BY l.ClientLookupValue,l.LookupID";
             
              
            SqlConnection sqlCnn = new SqlConnection();
            sqlCnn.ConnectionString = ConfigurationManager.ConnectionStrings["appConnString"].ConnectionString;
            try
            {
                DataSet ds = new DataSet();
                SqlCommand sqlCmd = new SqlCommand(sql,sqlCnn);
                sqlCmd.Parameters.Add("@OrganizationID",SqlDbType.Int);
                sqlCmd.Parameters["@OrganizationID"].Value = int.Parse(Report.ReportParameters["OrganizationID"].Value.ToString());
                SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd);
                adapter.Fill(ds);
  
                procChart.DataSource = ds;
                chart1.Series[0].DataLabelsColumn = "AUSStatusCnt";
                chart1.Series[0].DataYColumn = "AUSStatusCnt";
                  
                chart1.Legend.Visible = false;
  
                chart1.PlotArea.XAxis.DataLabelsColumn = "AUSStatus";
                chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 0;
                chart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.DarkSlateBlue;
                chart1.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Reporting.Charting.Styles.Unit.Percentage(20);
                chart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 10,FontStyle.Bold);
  
                  
  
                adapter.Dispose();
                sqlCmd.Dispose();
                sqlCnn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error loading report! ");
            }
  }
Steve
Telerik team
 answered on 28 Apr 2011
3 answers
86 views
Hello,

I know in a "detail" page of a report you can create a "loop". In my app I make each detail area show a ticket.
Right now my detail area fits 5 boxes- one on top of antoher.

Is it possible to make a detail area go both horizontal & verticle?
In .net webform this would like like setting a RadioGroup or TableView to repeat 2 columns wide and unlimited long.

Sample of what I'm trying to accomplish: http://img101.imageshack.us/img101/5752/10perpage.png

As you can see it loop 2 columns wide. If there's an odd number of rows the last column on the last row would be blank.
Massimiliano Bassili
Top achievements
Rank 1
 answered on 28 Apr 2011
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?