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

Remove images when exporting grid?

4 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alan T
Top achievements
Rank 1
Alan T asked on 14 Dec 2011, 04:12 PM
Hi, i've got a radgrid with some template columns in that contain images.

Although when exporting the images aren't displayed, a missing image icon is displayed in its place. What i'd like to do is at the point of exporting, remove any images in each row if any are present, replacing them, ideally with their alt tag, resulting in just text.


Is this possible ?

Also i'm pretty sure this isn't possible but are you able to include data from another control in the page such as a header for example ?

e.g. i've got a radgrid of hits and their associated item. It'd be nice if i could put some totals in the exported file, which at the moment i'm showing in a seperate table inside a panel.


thanks, Alan

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Dec 2011, 06:33 AM
Hello Alan,

Try the following code snippet.
C#:
protected void Button1_Click(object sender, EventArgs e)
{
RadGrid1.ExportSettings.ExportOnlyData = true;
foreach (GridDataItem item in RadGrid1.Items)
{
   TableCell cell = (TableCell)item["TemplateColumnUniqueName"];
   cell.Text = "your text";
}
RadGrid1.MasterTableView.ExportToExcel();
}

-Shinu.
0
Alan T
Top achievements
Rank 1
answered on 05 Jan 2012, 04:57 PM
if i adapt the code you've written below, to check each rows controls collection for an 'Image' type then remove the image;

won't that then remove them from the grid itself though ?

i only want them removed from the exported file.

0
Daniel
Telerik team
answered on 10 Jan 2012, 11:43 PM
Hi Alan,

Any changes you perform before exporting will not have any effect on your page - they will be applied to the exported file only.
By the way, have you tried to use the ExportOnlyData option?

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
0
Alan T
Top achievements
Rank 1
answered on 30 Jan 2012, 07:37 PM
sorry seem to have got posts mixed up here;

http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-read-gridtemplatecolumn.aspx#1967246

Tags
Grid
Asked by
Alan T
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Alan T
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or