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

Printing Gridview contents

3 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Saranya
Top achievements
Rank 1
Saranya asked on 29 Jul 2011, 11:59 AM
Hi All,

          I am using Telerik WPF Radgridview 2010.2.924.35 version for Printing the contents of gridview. When i select Microsoft XPS Document, a xps file is created and it contains the proper data that is present in the gridview.  When i print the contents after selecting the Printer, i am gettting the correct headers and number of rows and not the cell content. all rows have blank values. What is the problem? i followed the same steps followed in Printing demo in your samples. for the demo sample, i m getting all row values when a printer is selected.

But the only difference is in demo they have used gridviewdatacolumn to bind data. I used celltemplate and celledittemplate to bind row data. Why is the content missing. I also installed 2011 trial version and i ended up with the same issue. Any ideas or help is appreciated. Preferably code samples are welcome.

Thanks in advance,
Saranya.

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 05 Aug 2011, 06:47 AM
Hi Saranya,

We have tested the scenario you have. Unfortunately, we may not provide a solution for this situation for the time being.
What we may suggest you is to upgrade to the Q1 2011 (or better Q2 2011) version, where you may use the RadDocument for printing with RadRichTextBox.

Greetings,
Didie
the Telerik team

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

0
Saranya
Top achievements
Rank 1
answered on 05 Aug 2011, 07:00 AM
Hi Didie, 

             i solved the above issue by converting the Columns in the

ToPrintFriendlyGrid method of PrintExtensions.cs class from TelerikColumn to TelerikDataColumn. Also Don't forget to specify the DataMemberBinding Property while defining datacolumns in Xaml as below.

 

I am posting the code below so that it will be useful for others also.

<telerik:GridViewDataColumn Width="*" IsSortable="True" DataMemberBinding="{Binding LastName}" Header="Last Name" HeaderTextAlignment="Center" UniqueName="LastName"/>

 

foreach (Telerik.Windows.Controls.GridViewDataColumn column in source.Columns.OfType<Telerik.Windows.Controls.GridViewDataColumn>())
{ 
                Telerik.Windows.Controls.GridViewDataColumn newColumn = new GridViewDataColumn();
                newColumn.Header = column.Header;
                newColumn.HeaderTextAlignment = TextAlignment.Center;
                newColumn.DataMemberBinding = new System.Windows.Data.Binding(column.DataMemberBinding != null ? Convert.ToString(column.DataMemberBinding.Path.Path) : string.Empty);
}

Thanks,
R.Saranya.
0
Maya
Telerik team
answered on 05 Aug 2011, 07:07 AM
Hi Saranya,

Thank you a lot for sharing the solution you found. I have updated your Telerik point.
 

Kind regards,
Maya
the Telerik team

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

Tags
GridView
Asked by
Saranya
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Saranya
Top achievements
Rank 1
Maya
Telerik team
Share this question
or