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

[Solved] Any other method to export in Excel ?

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Max Figueredo
Top achievements
Rank 1
Max Figueredo asked on 08 Jul 2009, 09:05 PM
Hello,

I have a RadGrid, and I'm trying to set it to export to Excel. The problem is I'm getting the widely discussed "The controls collection cannot be modified because the control contains code blocks (i.e. <%...%>)".

After searching around, I understand that any javascript must be within a RadCodeBlock in order to avoid this problem. Easier said than done. Long story short the people that wrote the application I'm working on were completely crazy, they are outputting javascript generated at runtime all over the page, the solution of using RadCodeBLocks it is not really practical or possible in my scenario, I think.

Is there any other way around this to make the export to Excel work ? all I need is to export to Excel, what is the relation between the export to Excel feature, and the JavaScript on the page ?

Thank you very much !!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Jul 2009, 07:15 AM
Hello Max,

As I understand, it is not possible for you to use RadCodeBlock to allow client script. If so, try testing the following approach, i.e, you just need to move all the javascript code outside of the head tag and place it probably inside the body tag as shown below:

Before:    
<head runat="server"
   <script> 
   var controlClientObject = <%= RadControl1.ClientID %> 
   ... 
   </script> 
</head> 
 
<body> 
... 
</body> 

After:    
<head runat=server> 
</head> 
<body> 
   <script> 
   var controlClientObject = <%= RadControl1.ClientID %> 
   ... 
   </script> 
... 
</body> 

Hope this helps...
Princy.
Tags
Grid
Asked by
Max Figueredo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or