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

GridView - Print and Export with RadDocument

0 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 26 Aug 2011, 05:57 PM
I've been following the Print and Export with RadDocument example to print some data from the GridView.  Initially I had no problems getting simple examples to work.  I recently upgraded to RadControls_for_Silverlight4_2011_2_0712_Trial and implemented my solution based on the examples.  I've been getting a null Ref exception in Telerik.Controls.Document and am unable to get my implementation to work let alone a simple example.

I compiled the Example project from RadControls_for_Silverlight4_2011_2_0712_Trial, it runs fine, click on GridView, Other GridView Examples, Print and Export with RadDocument, hit print, the dialog shows, then Print, and white screen.  I've tried this running in VS and simple through casini.  This same process from http://demos.telerik.com/silverlight works fine.

As far as I can tell it blows up on this line:
RadDocument document = this.owner.Owner.Document;

Method UpdateBody In (HeaderFooterPresenterBase):
internal void UpdateBody()
   {
     if (((this.owner == null) || (this.owner.LastHeaderFooterChangeSource != this)) && this.isTemplateApplied)
     {
       HeaderFooterType headerFooterType = this.AssociatedSectionBox.GetHeaderFooterType();
       if (!this.headersFootersChanged)
       {
         HeaderFooterType? lastHeaderFooterType = this.lastHeaderFooterType;
         HeaderFooterType type2 = headerFooterType;
         if ((((HeaderFooterType) lastHeaderFooterType.GetValueOrDefault()) == type2) && lastHeaderFooterType.get_HasValue())
         {
           return;
         }
       }
       RadDocument body = this.GetBody();
       body.MeasureAndArrangeInDefaultSize();
       body.Sections.First.FirstPageNumber = this.AssociatedSectionBox.PageNumber;
       RadDocument document = this.owner.Owner.Document;
       body.FieldsDisplayMode = document.FieldsDisplayMode;
       body.MailMergeDataSource.ItemsSource = new object[] { document.MailMergeDataSource.CurrentItem };
       body.UpdateAllFields();
       this.SetDocumentSilently(body);
       this.headersFootersChanged = false;
       this.lastHeaderFooterType = new HeaderFooterType?(headerFooterType);
     }
   }

That could be wrong and I could be causing the problem but I don't know why I can't get printing to work in the Example_CS solution.

edit:
Tested my solution with RadControls_for_Silverlight4_2011_2_0823_TRIAL_hotfix and I'm able to print. :)

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Share this question
or