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

Export Problem from grid

2 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Giri
Top achievements
Rank 1
Giri asked on 20 Oct 2008, 11:06 AM
Hi,
    I am exporting datas from radgrid to an excel sheet.But i set the visible of the grid is false.So here there is problem arising to export,the column headers cannot be show only the datas will export.But if i set the visible proerty true for the grid then i the columns also export for me.But only i want to export the grid in invisible mode.
              Codings i am using to export are below..

                RadGrid1.ExportSettings.ExportOnlyData = true;
                RadGrid1.ExportSettings.IgnorePaging = true;
                RadGrid1.ExportSettings.OpenInNewWindow = true;
                RadGrid1.MasterTableView.ExportToExcel();   


Regards,
Giri

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Oct 2008, 11:14 AM
Hi,

Try setting the visbility of the grid before exporting the grid as shown below:

 protected void Button1_Click(object sender, EventArgs e)
        {
            RadGrid1.Visible = true;
            RadGrid1.Rebind();
            RadGrid1.ExportSettings.ExportOnlyData = true;
            RadGrid1.ExportSettings.IgnorePaging = true;
            RadGrid1.ExportSettings.OpenInNewWindow = true;
            RadGrid1.MasterTableView.ExportToExcel();   
        }

Thanks,
Shinu
0
Daniel
Telerik team
answered on 21 Oct 2008, 03:38 PM
Hello Giri,

You should temporary set the Visible property of your RadGrid to true in order to prevent such behavior. The code suggested by Shinu will help you achieve the desired functionality.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Giri
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or