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

PDF output some column empty?

2 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 17 Nov 2008, 08:34 PM
I've got a grid 800px wide that I'm PDFing to 11X8.5, however the first two column of the grid are blank in the PDF , the column headers are there but no data.

2 Answers, 1 is accepted

Sort by
0
david
Top achievements
Rank 1
answered on 17 Nov 2008, 09:06 PM
A little more info, I'm using a GridHyperLinkCOlumn, so I'm following the documentation like so

RadGrid1.MasterTableView.Columns.FindByUniqueName(

"CourseID").Visible = false;

 

RadGrid1.MasterTableView.Columns.FindByUniqueName(

"CourseIDforPDF").Visible = true;

 

RadGrid1.MasterTableView.ExportToPdf();

RadGrid1.MasterTableView.Columns.FindByUniqueName(

"CourseIDforPDF").Visible = false;

 

RadGrid1.MasterTableView.Columns.FindByUniqueName(

"CourseID").Visible = true


CourseID is the hyperlinkcolumn
CourseIDforPDF is the GridBoundColumn

oddly it still prints the column header for CourseID but not for CourseIDforPDF ??

 

0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Nov 2008, 05:42 AM
Hi David,

Try rebinding the Grid before exporting as shown below.


ASPX:
                 <Columns> 
                      
                     <telerik:GridBoundColumn DataField="ProductID" HeaderText="ProductID" UniqueName="ProductID" ></telerik:GridBoundColumn> 
                     <telerik:GridBoundColumn DataField="SupplierID" HeaderText="SupplierID" UniqueName="SupplierID" ></telerik:GridBoundColumn> 
                     <telerik:GridHyperLinkColumn DataTextField="ProductName"   DataNavigateUrlFields="ProductName"  HeaderText="HypCol" UniqueName="HypCol"></telerik:GridHyperLinkColumn> 
                     <telerik:GridBoundColumn DataField="ProductName" Visible="false" HeaderText="HypCol" UniqueName="ProductName" ></telerik:GridBoundColumn> 
                    </Columns> 

CS:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.GetColumn("HypCol").Visible = false
        RadGrid1.MasterTableView.GetColumn("ProductName").Visible = true
        RadGrid1.Rebind(); 
        RadGrid1.MasterTableView.ExportToPdf(); 
    } 


Thanks
Shinu.
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
david
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or