This is a migrated thread and some comments may be shown as answers.

PageNumber / PageCount problem

3 Answers 978 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Koen L
Top achievements
Rank 1
Koen L asked on 29 Mar 2012, 09:18 AM
I'm trying to display the PageNumber / PageCount in a textbox in the footer area of the main report. The steps I have taken are:
-drag a textbox to the mainpage's footer area
-rightclick the textbox choose expression..
- go to global objects
- double click PageNumber and PageCount
- manually add a string value so I get "= PageNumber + " / " + PageCount"

When I run the report I get the error:
An error has occurred while processing TextBox 'txtPageNumber':
The expression contains object 'PageNumber' that is not defined in the current context.

Why isn't this working?

3 Answers, 1 is accepted

Sort by
0
Koen L
Top achievements
Rank 1
answered on 29 Mar 2012, 09:24 AM
the code in the designer.cs file:
//
// txtPageNumber
//
this.txtPageNumber.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Cm(15.899999618530273D), Telerik.Reporting.Drawing.Unit.Cm(0.00019984244136139751D));
this.txtPageNumber.Name = "txtPageNumber";
this.txtPageNumber.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3.2999002933502197D), Telerik.Reporting.Drawing.Unit.Cm(0.59980064630508423D));
this.txtPageNumber.Style.Color = System.Drawing.Color.DarkGray;
this.txtPageNumber.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right;
this.txtPageNumber.Value = "= PageNumber + \"/\" + PageCount";
0
Peter
Telerik team
answered on 29 Mar 2012, 11:35 AM
Hi Koen L,

Since the paging of a report strongly depends on the format it is rendered to, the Page Footer/Header  
and its items are processed by the corresponding rendering extension after the report data has been processed. At this moment the report data source is not available anymore and due to this you can use the built-in PageNumber and PageCount objects only in the Page Footer/Header sections. Thus make sure that the textbox is located in a Page Footer section.

Kind regards,
Peter
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Koen L
Top achievements
Rank 1
answered on 29 Mar 2012, 12:18 PM
The textbox was located in the report footer not the page footer.
Problem is solved.
Tags
General Discussions
Asked by
Koen L
Top achievements
Rank 1
Answers by
Koen L
Top achievements
Rank 1
Peter
Telerik team
Share this question
or