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

Checkbox Export to Excel Issue

5 Answers 333 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Parth
Top achievements
Rank 1
Parth asked on 03 Sep 2010, 01:46 PM
Hello,

I have checkbox in the grid and when i try to export to excel it comes out as blank values.
Can you please provide me the solution, It is urgent please.

<telerik:GridCheckBoxColumn DataField="SiHy" HeaderText="SiHy" SortExpression="SiHy" UniqueName="SiHy" AllowFiltering="false"/>
exportOnlyData is set to true; Is there anything else I need to do ?
When I set exportOnlyData to false it exports the real checkbox to excel. I want the values.

Regards,
Parth Patel

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Sep 2010, 02:47 PM
Hello Parth,

Please download the attached project and let me know whether it works as expected at your side.

Regards,
Daniel
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
Accepted
Cori
Top achievements
Rank 2
answered on 03 Sep 2010, 03:03 PM
Hello Parth,

I think the best way to export the values for the GridCheckBoxColumn would be to create a hidden GridTemplateColumn that you make visible when exporting. So in the ItemCommand event you would do this:

protected void grdTest_ItemCommand(object source, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.ExportToPdfCommandName)
        {
            // hide checkbox column
            RadGrid1.MasterTableView.Columns[0].Visible = false;
            // show template column
            RadGrid1.MasterTableView.Columns[1].Visible = true;
        }
    }

In the TemplateColumn you can determine what you show if it true/false. You need to change the column index in my code to match the actual index in your grid.

I hope that helps.
0
Parth
Top achievements
Rank 1
answered on 03 Sep 2010, 03:04 PM
Daniel,

This works fine But I ran into other issue.

In my grid I have some griddropdown columns and gridcheckboxcolumn.

If I use ExcelML format it gives the correct values for the checkbox but for dropdown it is giving ids instead of text. So I believe that ExcelML format gives me the real data not the presentation data.

If I use HTML format it gives the correct values for the dropdowns but for checkbox it is giving blank values.

Is there any middle solution for it??

Regards,
Parth
0
Parth
Top achievements
Rank 1
answered on 03 Sep 2010, 03:23 PM
Cori,

How can I set the export buttons in the grid?? 

I saw the example in the telerik website about setting the icons for the export in the grid, But I dont have those options in my controls.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx

Right now I am doing export from the external button. From the external export it does not call the ItemCommand event.

Please help me with this..

Thanks,
Parth
0
Accepted
Daniel
Telerik team
answered on 03 Sep 2010, 03:38 PM
Hello Parth,

As you have noticed, ExcelML exports the data directly from the datasource. If you want to change the default behavior, you should handle the ExcelMLRowCreated event and replace the value manually.
ExcelML export
ExcelML structure / GridExcelBuilder

Best regards,
Daniel
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
Tags
Grid
Asked by
Parth
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Cori
Top achievements
Rank 2
Parth
Top achievements
Rank 1
Share this question
or