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

how to export certain field in a grid

3 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 23 Jan 2010, 12:41 AM
hi

I have a grid that has maybe 10 fields, but i want to export only certain fields in the grid to PDF. How should i go about it? Thanks

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Jan 2010, 12:45 PM
Hello,

If you want to hide certain columns in the exported pdf file, then you can try hiding the unwanted columns as shown in the following code snippet.

CS:
 
    protected void Button3_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.Columns.FindByUniqueName("CompanyName").Visible = false;  // Hide the column 
        RadGrid1.ExportSettings.ExportOnlyData = true
        RadGrid1.ExportSettings.OpenInNewWindow = true
        RadGrid1.MasterTableView.ExportToPdf(); 
    } 

-Shinu.
0
sln007
Top achievements
Rank 1
answered on 07 Jun 2011, 02:28 PM
Shinu,

I am using the correct technique to hide a column for ExportToPdf() and ExportToExcel().......(I have tried each of the following)

 

rdgrdBASE.MasterTableView.Columns.FindByUniqueName("Actions").Visible = false;
  
rdgrdBASE.MasterTableView.GetColumn("Actions").Visible = false;

 

 


The problem is that the Column header text is still being produced in the PDF output and a column
is also procuded in the Excel output.

Why is the particular column being produced?  It is taking up space on the Pdf page and creating an empty
column in Excel?

 

 

 

0
Shinu
Top achievements
Rank 2
answered on 07 Jun 2011, 02:50 PM
Hello,

I cannot find out any mistakes in the code. I hope this help documentation will help you to solve the issue.
PDF export.
Word/Excel export (HTML-based).
Please elaborate your scenario if it doesn't help.

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