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

Export Rad Grid to Excel file problem

8 Answers 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AHSAN
Top achievements
Rank 1
AHSAN asked on 21 Jan 2011, 06:05 PM
Hello There, 

I am trying to export a RadGrid to an excel sheet but I get this error"   Script control 'RadGrid1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl ". However, when I use GridView, it works fine. this is the function to export the Radgrid to excel.

 Response.Clear();
          
            Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
            Response.Charset = "";
         // Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = "application/vnd.xls";
         // htmlWrite.WriteLine(header2);
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
            RadGrid1.RenderControl(htmlWrite);
            //GridView1.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();

Thank you so much
Ahsan 

8 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jan 2011, 06:20 PM
Hello Ahsan,

This approach won't work out-of-the-box since RadGrid is a sophisticated control with much more functionality than the standard GridView. That said, the easiest way would be to use the built-in exporting capabilities:
Word/Excel export (HTML-based)
MS Excel/MS Word/CSV
Export to ExcelML
Export to PDF

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
AHSAN
Top achievements
Rank 1
answered on 21 Jan 2011, 06:25 PM
thank you so much Daniel for the fast reply, I will take a look at the links.

Thanks again
Ahsan
0
Daryl
Top achievements
Rank 1
answered on 21 Jan 2011, 10:39 PM
I'm having problems with the export to Excel from Radgrid in SSL. The grid uses OnNeedDataSource to populate the grid. The export works fine locally, and in Chrome inside our DEV environment (using https), but fails in IE 8 in the same DEV environment. These steps have been followed as previously posted:
1) add the site to your trusted sites list;
2) add the site to your allowed sites in IE's pop-up blocker config;
3) ensure that "do not save encrypted pages to disk" is NOT checked in the Advanced section of Internet Options.


We are using version ASP.NET AJAX Q1 2010 NET35

Any help would be appreciated. 

0
Daniel
Telerik team
answered on 26 Jan 2011, 04:50 PM
Hello Daryl,

I believe I already answered to your support ticket. It is recommended that you use the workaround that is described in our documentation:
Export overview (Export over SSL section)

I hope this helps.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Libby Stainer
Top achievements
Rank 1
answered on 18 Aug 2011, 01:58 PM
Telerik Admin,
Your Export overview (Export over SSL section) link is broken, please could you supply this link again.
0
Shinu
Top achievements
Rank 2
answered on 18 Aug 2011, 02:17 PM
Hello Libby,

Here is the correct link.
http://www.telerik.com/help/aspnet-ajax/grid-export.html.

Thanks,
Shinu.
0
Paul
Top achievements
Rank 1
answered on 03 Jul 2012, 02:15 PM
Your link is broken again.  I'm trying to locate the solution to this problem as well.
0
Shinu
Top achievements
Rank 2
answered on 04 Jul 2012, 04:07 AM
Hello Paul,

Check the following help documentation.
Overview

Thanks,
Shinu.
Tags
Grid
Asked by
AHSAN
Top achievements
Rank 1
Answers by
Daniel
Telerik team
AHSAN
Top achievements
Rank 1
Daryl
Top achievements
Rank 1
Libby Stainer
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Paul
Top achievements
Rank 1
Share this question
or