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

Adding telerik:RadDatePicker in GridView and exporting to excel

1 Answer 12 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Michael Epley
Top achievements
Rank 1
Michael Epley asked on 21 Oct 2015, 07:04 PM

I have added telerik:RadDatePicker in a gridView. Its fetching results and calender as expected. But when i am exporting to excel. I am getting error.

 

Server Error in '/' Application.

Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

Source Error: 

Line 121: Line 122: // render the table into the htmlwriter Line 123: table.RenderControl(htw); Line 124: Line 125: // render the htmlwriter into the response
Source File: \App_Code\GridViewExportUtil.cs    Line: 123 

Stack Trace: 

[InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.] Telerik.Web.UI.ScriptRegistrar.GetScriptManager(Control control) +161 Telerik.Web.UI.RadWebControl.RegisterScriptDescriptors() +39‚Äč

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 26 Oct 2015, 10:20 AM
Hello,

The mentioned error most commonly appear if the control is not properly added in the controls collection of the Page or the controls collection of any other control already added to the Page. I believe in your case you are adding the DatePicker dynamically and for some reason this issue appears.
Can you pleas share your page markup as well as related code behind so that we can revise them locally and advise you further?

Regards,
Maria Ilieva
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Michael Epley
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or