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

Exporting RAD grid with additional data

10 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sarath Darsi
Top achievements
Rank 1
Sarath Darsi asked on 13 Apr 2010, 02:18 PM
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()

10 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 13 Apr 2010, 07:32 PM
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.
0
Sarath Darsi
Top achievements
Rank 1
answered on 14 Apr 2010, 08:18 AM
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
0
Daniel
Telerik team
answered on 16 Apr 2010, 02:27 PM
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.
0
Sarath Darsi
Top achievements
Rank 1
answered on 16 Apr 2010, 04:23 PM
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
0
Accepted
Daniel
Telerik team
answered on 21 Apr 2010, 09:50 PM
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.
0
Sarath Darsi
Top achievements
Rank 1
answered on 22 Apr 2010, 09:44 AM
Thank you Daniel.Now exporting is working with additional data fine.


Regards,
Sarath.
0
Arun
Top achievements
Rank 1
answered on 04 Jan 2012, 09:20 AM
Hi Sharat,

  Can you share your code, as we are evaluating this telerik feature, we were unable to do it.
0
Anzar
Top achievements
Rank 2
answered on 03 Dec 2012, 10:23 AM
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
0
Kostadin
Telerik team
answered on 06 Dec 2012, 09:26 AM
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.
0
Daniel
Telerik team
answered on 06 Dec 2012, 01:44 PM
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.
Tags
Grid
Asked by
Sarath Darsi
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Sarath Darsi
Top achievements
Rank 1
Arun
Top achievements
Rank 1
Anzar
Top achievements
Rank 2
Kostadin
Telerik team
Share this question
or