Problem using "GridExporting" to format output.

2 posts, 0 answers
  1. Ken Lassesen
    Ken Lassesen avatar
    37 posts
    Member since:
    Nov 2008

    Posted 15 Jun 2010 Link to this post

    I'm trying to customize the output format of a grid. Code that logically should work, seems to have no effect...


    // Add event handler   
    grid.GridExporting += new OnGridExportingEventHandler(grid_GridExporting);   
    which points to:



    // The handler: showing only the PDF branch   
    static void grid_GridExporting(object source, GridExportingArgs e)   
    RadGrid grid = (RadGrid)source;   
    switch (e.ExportType)   
        case ExportType.Pdf:   

    Which calls:





    // The routine, trimmed to simple example...  the code executes when I step thru it...  
    static void ApplyStylesToPDFExport(GridTableView gtable)   
    foreach (GridColumn col in gtable.Columns)   
    col.HeaderStyle.BackColor = System.Drawing.Color.Silver;   
    col.HeaderStyle.ForeColor = System.Drawing.Color.Red;   




    So what am I doing wrong OR how can I do the equivalent.  The PDF export is done by the built-in export buttons...   All of the code is in a Utility class because it will be used on dozens of pages...



  2. Daniel
    Daniel avatar
    4949 posts

    Posted 18 Jun 2010 Link to this post

    Hello Ken,

    I'm afraid it is too late to apply these styles on GridExporting when exporting to PDF. Note that the binary output is already generated at this point so the changes wouldn't take effect.
    I would recommend that you use ItemDataBound and ItemCreated events instead.

    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
Back to Top