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

FIELDS collection not binding?

1 Answer 191 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 09 Aug 2012, 11:23 AM

I have recently upgraded to 2012 Q2, from 2008 Q3, and now none of textboxes or pictureboxes that utilize the =FIELDS collection have anything in them, and all this worked fine with the earlier version.  Below is the definition of the page, and the method that utilizes/manipulates the data.  The only thing that appears on the page is the current date. 

Anyone have ANY idea why the data is not binding?

Thanks,
Rich

Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
  
Public Class CoverPage
    Inherits Telerik.Reporting.Report
    Friend WithEvents PageHeaderSection1 As Telerik.Reporting.PageHeaderSection
    Friend WithEvents DetailSection1 As Telerik.Reporting.DetailSection
    Private WithEvents pictureBox1 As Telerik.Reporting.PictureBox
    Private WithEvents textBox1 As Telerik.Reporting.TextBox
    Private WithEvents textBox8 As Telerik.Reporting.TextBox
    Private WithEvents textBox9 As Telerik.Reporting.TextBox
    Private WithEvents textBox10 As Telerik.Reporting.TextBox
    Private WithEvents textBox2 As Telerik.Reporting.TextBox
    Friend WithEvents PageFooterSection1 As Telerik.Reporting.PageFooterSection
  
    Public Sub New()
        InitializeComponent()
  
    End Sub
  
    'NOTE: The following procedure is required by the telerik Reporting Designer
    'It can be modified using the telerik Reporting Designer.  
    'Do not modify it using the code editor.
    Private Sub InitializeComponent()
        Me.PageHeaderSection1 = New Telerik.Reporting.PageHeaderSection()
        Me.pictureBox1 = New Telerik.Reporting.PictureBox()
        Me.textBox1 = New Telerik.Reporting.TextBox()
        Me.textBox8 = New Telerik.Reporting.TextBox()
        Me.textBox9 = New Telerik.Reporting.TextBox()
        Me.textBox10 = New Telerik.Reporting.TextBox()
        Me.textBox2 = New Telerik.Reporting.TextBox()
        Me.DetailSection1 = New Telerik.Reporting.DetailSection()
        Me.PageFooterSection1 = New Telerik.Reporting.PageFooterSection()
        CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        '
        'PageHeaderSection1
        '
        Me.PageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(8.7895841598510742R)
        Me.PageHeaderSection1.Items.AddRange(New Telerik.Reporting.ReportItemBase() {Me.pictureBox1, Me.textBox1, Me.textBox8, Me.textBox9, Me.textBox10, Me.textBox2})
        Me.PageHeaderSection1.Name = "PageHeaderSection1"
        '
        'pictureBox1
        '
        Me.pictureBox1.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.010456085205078125R), Telerik.Reporting.Drawing.Unit.Inch(0.010456006042659283R))
        Me.pictureBox1.MimeType = ""
        Me.pictureBox1.Name = "pictureBox1"
        Me.pictureBox1.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(2.9791271686553955R), Telerik.Reporting.Drawing.Unit.Inch(1.9791272878646851R))
        Me.pictureBox1.Sizing = Telerik.Reporting.Drawing.ImageSizeMode.ScaleProportional
        Me.pictureBox1.Value = "=Fields.LOGO"
        '
        'textBox1
        '
        Me.textBox1.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0062500634230673313R), Telerik.Reporting.Drawing.Unit.Inch(2.5R))
        Me.textBox1.Name = "textBox1"
        Me.textBox1.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4728379249572754R), Telerik.Reporting.Drawing.Unit.Inch(0.38958358764648438R))
        Me.textBox1.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(20.0R)
        Me.textBox1.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox1.Value = "=Fields.JOB_NAME"
        '
        'textBox8
        '
        Me.textBox8.Format = "{0:d}"
        Me.textBox8.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0R), Telerik.Reporting.Drawing.Unit.Inch(3.1314079761505127R))
        Me.textBox8.Name = "textBox8"
        Me.textBox8.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4790878295898437R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox8.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox8.Value = "=Now()"
        '
        'textBox9
        '
        Me.textBox9.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0R), Telerik.Reporting.Drawing.Unit.Inch(2.9104957580566406R))
        Me.textBox9.Name = "textBox9"
        Me.textBox9.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4790878295898437R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox9.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox9.Value = "=Fields.PROJECT_NUMBER"
        '
        'textBox10
        '
        Me.textBox10.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(3.5104167461395264R), Telerik.Reporting.Drawing.Unit.Inch(0.010456045158207417R))
        Me.textBox10.Name = "textBox10"
        Me.textBox10.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(2.9686708450317383R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox10.Value = "=Fields.ENTIRE_ADDR"
        '
        'textBox2
        '
        Me.textBox2.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.031368255615234375R), Telerik.Reporting.Drawing.Unit.Inch(6.0208334922790527R))
        Me.textBox2.Name = "textBox2"
        Me.textBox2.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4686317443847656R), Telerik.Reporting.Drawing.Unit.Inch(2.7687110900878906R))
        Me.textBox2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Bottom
        Me.textBox2.Value = "=Fields.COVER_PAGE_TEXT"
        '
        'DetailSection1
        '
        Me.DetailSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699R)
        Me.DetailSection1.Name = "DetailSection1"
        '
        'PageFooterSection1
        '
        Me.PageFooterSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699R)
        Me.PageFooterSection1.Name = "PageFooterSection1"
        '
        'CoverPage
        '
        Me.Items.AddRange(New Telerik.Reporting.ReportItemBase() {Me.PageHeaderSection1, Me.DetailSection1, Me.PageFooterSection1})
        Me.Name = "CoverPage"
        Me.PageSettings.Landscape = False
        Me.PageSettings.Margins.Bottom = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Left = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Right = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Top = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter
        Me.Style.BackgroundColor = System.Drawing.Color.White
        Me.Width = Telerik.Reporting.Drawing.Unit.Inch(6.5R)
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
  
    End Sub
End Class
  
  
   Private Sub CreateCoverPage(ByVal submittalID As Decimal, ByVal doc As PDFDocument)
  
        Dim dtCover As doSubmittal.CoverPageDataTable
        Using rpt As New boSubmittal
            dtCover = rpt.CoverPage_GetBySubmittalID(submittalID)
        End Using
        Dim dr As doSubmittal.CoverPageRow = dtCover(0)
  
        dr.ENTIRE_ADDR = String.Empty
        If Not dr.IsREP_NAMENull Then dr.ENTIRE_ADDR &= dr.REP_NAME & vbCrLf
        If Not dr.IsADDR_LINE_1Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_1.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_1 & vbCrLf
        If Not dr.IsADDR_LINE_2Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_2.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_2 & vbCrLf
        If Not dr.IsADDR_LINE_3Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_3.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_3 & vbCrLf
        If Not dr.IsCITYSTATEZIPNull Then dr.ENTIRE_ADDR &= dr.CITYSTATEZIP & vbCrLf
        If Not dr.IsPHONE_NUMBERNull Then dr.ENTIRE_ADDR &= "Phone: " & dr.PHONE_NUMBER & vbCrLf
        If Not dr.IsFAX_NUMBERNull Then dr.ENTIRE_ADDR &= "Fax: " & dr.FAX_NUMBER & vbCrLf
        If Not dr.IsREP_CONTACT_NAMENull Then dr.ENTIRE_ADDR &= "Contact: " & dr.REP_CONTACT_NAME & vbCrLf
  
        If Not dr.IsPRINT_CONTACTS_FLAGNull Then
            dr.ALL_CONTACTS = String.Empty
            Dim contacts = GetContacts(submittalID)
  
            dr.ALL_CONTACTS &= vbCrLf & "Submitted To: " & vbCrLf & contacts
  
        End If
  
        If Not dr.IsVERSION_NUMBERNull Then
            dr.PROJECT_NUMBER = dr.PROJECT_NUMBER & "-" & dr.VERSION_NUMBER
        End If
  
        Dim cvr As New CoverPage
        Dim mimType As String = String.Empty
        Dim extension As String = String.Empty
        Dim encoding As Encoding = Nothing
  
        Dim rptProcessor As New Telerik.Reporting.Processing.ReportProcessor()
  
        Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
        instanceReportSource.ReportDocument = cvr
        Dim result As Telerik.Reporting.Processing.RenderingResult = rptProcessor.RenderReport("PDF", instanceReportSource, Nothing)
  
        Dim fileName As String = result.DocumentName & ".pdf"
        Dim buffer As Byte() = result.DocumentBytes
  
        PDFFileEx.SerialNumber = _serialNumber
        Dim mctiFile As PDFFileEx = PDFFileEx.FromStream(New MemoryStream(buffer))
  
        Try
            ' extract the content 
            Dim ic As PDFImportedContent() = mctiFile.ExtractPagesContent()
  
            ' create the new document
            Dim pic As PDFImportedContent
            For Each pic In ic
                ' draw the imported content on the new page
                Dim page1 As PDFPage = doc.AddPage()
                page1.Canvas.DrawImportedContent(pic, 0, 0, page1.Width, page1.Height)
            Next
  
        Finally
            mctiFile.Close()
            mctiFile.Dispose()
            cvr.Dispose()
            dtCover.Dispose()
        End Try
  
  
    End Sub

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 14 Aug 2012, 07:15 AM
Hello Rich,

The report definition you have send us is not databound. This is why the report is blank. It seems that in the CreateCoverPage() method you create a datasource (dtCover). However it's never assigned to the Report.DataSource property. 

For more information and examples check out the How to: Bind to a DataTable help article. 

Greetings,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Rich
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or