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

Anchoring data to bottom of PDF

1 Answer 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John Mann
Top achievements
Rank 1
John Mann asked on 24 Jan 2012, 12:50 AM

I need to create a report with a data section that appears only at the bottom of the first page of a PDF report. From reading other posts it appears that the only way to do this is to put the fields into the page footer and then add values to the fields in ItemDataBound event of the footer. I've tried doing this, but the data doesn't appear on the first page, only on subsequent pages. Any ideas why this isn't working? Is this the proper way to go about this?

Here's a simplified view of what I'm doing.

private void pageFooter_ItemDataBound(object sender, EventArgs e)
{
  barcode1.Value = "123456"; 
  barcode2.Value = "234567"; 
  barcode3.Value = "345678"; 
  barcode4.Value = "456789"; 
  barcode5.Value = "567890"; 
  barcode6.Value = "678901"; 
  barcode7.Value = "789012"; 
  barcode8.Value = "890123"; 
  barcode9.Value = "901234"; 
}

I also want to suppress the display on pages other than page one. Can I toggle the visibility with conditional formatting based on PageNumber or is there a better way?

Thanks,

John

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 25 Jan 2012, 05:31 PM
Hi,

With conditional formatting you can hide the page footer (so it is only displayed in the first page). The rule would be :

Expression     Operator     Value
=PageNumber    <>            =1
and the style visible = false.

As for assigning of the values - the ItemDataBound event suggests that the data is already bound and it is too late to assign the definition values (by saying barcode1.Value - you are changing the definition of the element and not the processing value). If these barcodes are static you can assign their values this way in the constructor after the InitializeComponent() call. If you, however, need to do it in this event you should use the processing elements (not the definitions):

private void pageFooterSection1_ItemDataBound(object sender, EventArgs e)
{
    var footer = sender as Telerik.Reporting.Processing.PageSection;
 
    var barcode1 = (footer.ChildElements.Find("barcode1", true))[0] as Telerik.Reporting.Processing.Barcode;
    barcode1.Value = "...";
}

This approach is not advisable as it creates more difficulties.  Regards,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
John Mann
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or