bool values export

2 posts, 0 answers
  1. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 02 Dec 2014 Link to this post

    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?

  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 03 Dec 2014 Link to this post


    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;


    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top