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

Drop a column while exporting

2 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sabyasachi Dechaudhari
Top achievements
Rank 1
Sabyasachi Dechaudhari asked on 02 Aug 2010, 02:16 PM
I have a template column. I dont want to export it.
I tried to do
1. Make the column visible=false before export
grd.Columns[0].Visible = false;

grd.MasterTableView.ExportToExcel();

grd.Columns[0].Visible =

true;

 


2. Add attribute.add to cell and make it visible = false.

e.Row.Cells[0].Attributes.Add(

"visible", "false");

 


3. Remove the cell

e.Row.Cells.RemoveAt(0);


However i was unsucessfull .. can you pls suggest a wasy so that the column is not exported and there is no blank column in the export

 

grd.ExportSettings.IgnorePaging =

true;

 

grd.ExportSettings.OpenInNewWindow =

true;

 

grd.ExportSettings.Excel.Format = Telerik.Web.UI.

GridExcelExportFormat.Html;

 

grd.ExportSettings.ExportOnlyData =

true;

 

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 05 Aug 2010, 10:59 AM
Hi Sabyasachi,

I suggest that you find the column which you need to hide by UniqueName and not index:

protected void button1_Click(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.GetColumn("ProductName").Visible = false;
    RadGrid1.MasterTableView.ExportToExcel();
}


Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sabyasachi Dechaudhari
Top achievements
Rank 1
answered on 17 Aug 2010, 07:15 AM
the problem was i was setting it back to true after firing the command export to excel. I removed the command to convert it back to origin valuw ant it did the trick
Tags
Grid
Asked by
Sabyasachi Dechaudhari
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Sabyasachi Dechaudhari
Top achievements
Rank 1
Share this question
or