Problem with ElementExporting event in RadGridView.

4 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 20 Jan 2011 Link to this post

    Hello,

    The GridView has the ElementExporting event allowing user to customize the element being exported and/or take other actions.

    Apparently sometimes the custom-formatted row cell values assigned to the GridViewElementExportingEventArgs.Value property in the handler of such event are dropped and the corresponding cells display as blank in the exported Excel doc. The examination of generated HTML file confirms that the values are indeed missing. The error has irregular random nature; no pattern/condition for its occurrence has been found. Sometimes of two documents generated from the same grid with the same data one may have all cells populated, and another missing some values.

    Is this issue known to Telerik? Are there any additional required actions (setting some flag, etc.) when overriding the Value property of the GridViewElementExportingEventArgs class with the custom value for the row cell?

    Thanks,
    Rob

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Jan 2011 Link to this post

    Hi Rob,

    Actually we are not aware of such issue. It sounds very weird. You do not need to set any flags or something, just setting e.Value = your_data should be enough.
    Still, can you paste here your code so we can have a better idea.
    How many rows does the gridview have?


    All the best,
    Veselin Vasilev
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Srinivas
    Srinivas avatar
    2 posts
    Member since:
    Dec 2013

    Posted 25 Dec 2013 Link to this post



    Hi ,
    Am using a RadGridview control to populate my data and using the ElementExporting event to customize the data while exporting to Excel.

    My customization need goes like, I want to add some metadata(some info the grid like report name, date generated, owner etc , at the top A1 cell ) to the grid data that is getting exporting . beneat that my actual grid data should be shown, and it should be sorted as my need.
    I could able to append the metadata using the

    grdRiskClarityReport.Export(stream,

    new GridViewExportOptions()

    {

    Format=

    ExportFormat.Html,

    ShowColumnHeaders =

    true,

    ShowColumnFooters =

    true,

    ShowGroupFooters =

    false,

     

    });


    and my event goes like this,

    private void grdRiskClarityReport_ElementExported(object sender, GridViewElementExportedEventArgs e)

    {

     

    if (e.Element == ExportElement.HeaderCell && temp== 0)

    {

     

    // if (obj != null)

    {

    e.Writer.Write(

    String.Format(@"<tr><td style=""background-color:#CCC;"" colspan=""{0}"">","dfdfd"));

    e.Writer.Write(

    String.Format(@"<b>Proposal Name:</b> {0} <br />", "dfdfd")); //need to input properdata

    e.Writer.Write(

    String.Format(@"<b>Proposal Status:</b> {0} <br />", "dfdfd"));

    e.Writer.Write(

    "</td></tr>");

    temp = 1;

    // using the restrict the metadata to the first cell

    }

    }

    }



    Could you please provide me a sample in wpf version that serves my need ?


    Thanks in advance,
    Srinivas J







  5. Yoan
    Admin
    Yoan avatar
    1069 posts

    Posted 30 Dec 2013 Link to this post

    Hello Srinivas,

    I have just replied to the other thread on the same topic.


    Regards,
    Yoan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top