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

bool values export

1 Answer 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 02 Dec 2014, 05:01 PM
I use this code for export to html:
grid.Export(stream, new GridViewExportOptions()
                            {
                                Format = Telerik.Windows.Controls.ExportFormat.Html,
                                ShowColumnFooters = grid.ShowColumnFooters,
                                ShowColumnHeaders = grid.ShowColumnHeaders,
                                ShowGroupFooters = grid.ShowGroupFooters
                            });

                    grid.ElementExporting -= elementExporting;
                    grid.ElementExported -= elementExported;

                    stream.Position = 0;

                    document = new HtmlFormatProvider().Import(stream);

works fine but the bool values look like "False" or "True" i need use other indicators like "✔" or "X".
what I need to do for that?


1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Dec 2014, 12:11 PM
Hello,

In order to override the default value to be exported (True or False), you can subscribe for the ElementExporting event and change the e.Value accordingly in case e.Element is ExportElement.Cell.

For example:

private void clubsGrid_ElementExporting(object sender, GridViewElementExportingEventArgs e)
{
    if (e.Element == ExportElement.Cell)
    {
        var column = e.Context as GridViewDataColumn;
        if (column != null && column.Header.ToString()=="BooleanColumn")
        {
        if (e.Value == true)
        {
            e.Value = valueyouwish;
        }
        }
    }
}

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Luis
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or