Exporting RAD grid with additional data

11 posts, 1 answers
  1. Sarath Darsi
    Sarath Darsi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 13 Apr 2010 Link to this post

    Hi,

    I want to export RAD Grid including some data with grid.I know how to expot RAD grid into exel.But i want to include some other data in excel.But this data is not included in Grid.Can you please assist me how to proceed this by modifying below code.

    grdQwest.ExportSettings.OpenInNewWindow =

    True

     

    grdQwest.ExportSettings.IgnorePaging =

    True

     

    grdQwest.ExportSettings.ExportOnlyData =

    True

     

    grdQwest.ExportSettings.FileName =

    "QWESTMetrics"

     

    grdQwest.MasterTableView.ExportToExcel()

  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 13 Apr 2010 Link to this post

    Hello Sarath,

    You can download a sample project from this thread:
    Link to public post

    I hope this helps.

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sarath Darsi
    Sarath Darsi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 14 Apr 2010 Link to this post

    Hi Daniel,

    Thanks for your reply.I don't want to modify cell formats or data..I need to add additional data in excel above exported excel..Can you please suggest me how to do this.

    Thanks,
    Sarath
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 16 Apr 2010 Link to this post

    Hello Sarath,

    The easiest way to insert text above RadGrid in this case would be to use the GridExporting event:
    protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
    {
        if(e.ExportType == ExportType.Excel)
        {
            string myContent = "<strong>TEST</strong>";
            e.ExportOutput = e.ExportOutput.Replace("<body>", "<body>" + myContent);
        }
    }

    Other than this, you can use an existing item as a placeholder - for example the command item:
    RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0].Cells[0].Text = "ASD";

    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.
  6. Sarath Darsi
    Sarath Darsi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 16 Apr 2010 Link to this post

    Hello Daniel,
    First option,
    I did not find RadGrid1_GridExporting event.When i am doing this it is giving compiling errors

    In second option,

    what is GridItemType here?

    Thanks,
    Sarath
  7. Answer
    Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 21 Apr 2010 Link to this post

    Hello Sarath,

    GridExporting event is not a new event - your version of RadControls is probably quite old if you don't have it. Unfortunately there is no feasible workaround if this is the case - you should use the second approach.

    As to the second question - GridItemType is enumeration that is used to distinguish the item type:
    GridItemType Enumeration

    Example:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if(e.Item.ItemType == GridItemType.FilteringItem)
        {
            //...
        }
    }

    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.
  8. Sarath Darsi
    Sarath Darsi avatar
    4 posts
    Member since:
    Mar 2010

    Posted 22 Apr 2010 Link to this post

    Thank you Daniel.Now exporting is working with additional data fine.


    Regards,
    Sarath.
  9. Arun
    Arun avatar
    1 posts
    Member since:
    Oct 2011

    Posted 04 Jan 2012 Link to this post

    Hi Sharat,

      Can you share your code, as we are evaluating this telerik feature, we were unable to do it.
  10. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 03 Dec 2012 Link to this post

    Hi,
    How insert page header & Footer, Report Header and Footer and  Page setup in telerik grid exporting(as xml,doc,pdf etc). 


    Thanks & Regards
    Anzar.M
  11. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 06 Dec 2012 Link to this post

    Hi,

    I used the suggestions of my colleague Daniel and prepared a small sample where I demonstrate how you can insert header and footer in the exported file. 
    Test it on your end and verify if it covers your requirements.

    Regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  12. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 06 Dec 2012 Link to this post

    Hello Anzar,

    I would recommend that you stick to your own thread:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/635993-grid-exporting.aspx

    Kind regards,
    Daniel
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017