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

RadGrid Printing problem

1 Answer 61 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Akshay
Top achievements
Rank 1
Akshay asked on 12 Jun 2012, 06:22 AM
Hi I am using RadGrid Print using RadDocument.
But when I try to Print the Grid, I get an exception. I tried to look at the demo as well and I am facing the same problem there as well.

I am using Silverlight 4 runtime to develop my application.

The error I am getting is:
Webpage error details


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8)
Timestamp: Tue, 12 Jun 2012 06:21:59 UTC
Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
   at MS.Internal.XcpImports.UIElement_UpdateLayout(UIElement element)
   at Telerik.Windows.Documents.UI.DocumentPrintPresenter.UpdateEditorLayout()
   at Telerik.Windows.Documents.UI.DocumentPrintPresenter.DoOnDocumentChanged()
   at Telerik.Windows.Documents.UI.DocumentPrintPresenter.set_Owner(RadRichTextBox value)
   at Telerik.Windows.Controls.RadRichTextBox.InitActiveEditorPresenter()
   at Telerik.Windows.Controls.RadRichTextBox.set_ActiveEditorPresenter(IDocumentEditorPresenter value)
   at Telerik.Windows.Controls.RadRichTextBox.<>c__DisplayClass22.<Print>b__20(Object o, EventArgs e)
   at Telerik.Windows.Documents.UI.DocumentPrintPresenter.OnPrintingStarted()
   at Telerik.Windows.Documents.UI.DocumentPrintPresenter.pd_BeginPrint(Object sender, BeginPrintEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)     

Line: 120
Char: 13
Code: 0
URI: http://localhost:6519/Default.aspx

I am using the following code:
The RichTextBox is added to the visual tree as well.

private void btnPrint_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Dispatcher.BeginInvoke((Action)(() =>
            {
                RichTextBox.Document = CreateDocument(dgPortfolioDetails);
            }));
 
            PrintSettings printSettings = new PrintSettings();
            printSettings.DocumentName = "MyDocument";
            printSettings.PrintMode = PrintMode.Native;
            printSettings.PrintScaling = PrintScaling.ShrinkToPageSize;
            RichTextBox.Print(printSettings);
        }

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Jun 2012, 06:56 AM
Hello,

 I've just checked our demo here however everything worked as expected. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Akshay
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or