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

RadGrid - "An unexpected error has occured"

6 Answers 227 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Iomedex
Top achievements
Rank 1
Iomedex asked on 05 May 2009, 08:00 PM

We are using a scenario very similar to the SharePoint example with user controls being loaded into a web part. This has worked very well for us with the previous Telerik controls and now we are going to the newer AJAX suite of controls. However, we cannot get it to work without giving errors. So, we built a small test scenario using the steps below, but no matter the scenario, when a radgrid is on the page, it gives the dreaded "An unexpected error has occurred" error.

Deployment Steps based on this site http://www.telerik.com/help/aspnet-ajax/moss-deploying-radcontrols.html:
1. Drop the .net 3.5 version of the Telerik.Web.UI and Telerik.Web.Design dll's in the GAC
2. Add the safe control references in the web.config

<SafeControl Assembly="Telerik.Web.UI, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TypeName="*" Safe="True" />

 <

 

SafeControl Assembly="Telerik.Web.Design, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.Design" TypeName="*" Safe="True" />
3. Reset IIS
4. Build a generic page for testing with this code.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html dir="ltr">

<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<meta name="Microsoft Theme" content="SDL 1011, default" />
</head>
<body><form id="form1" runat="server">

<telerik:RadGrid ID='grid' runat="server"></telerik:RadGrid>

</form></body></html>

5. Run the page
6. The result is a SharePoint error like this
     An unexpected error has occurred.

     Troubleshoot issues with Windows SharePoint Services.

Additional comments:
1. Trying multiple sites (same server)
2. Putting the dll's in the _app_bin directory with the previous version of the Telerik controls and adding the references to the web.config
3. When running the grid in the web part, the error occurs before any of the user control code is called.
4. Tried using the 2.0 versions of the dll, but that would require reverting the site, which would break other things.
5. After looking through the log files numerous times and having others look through the SharePoint log files, there does not appear to be any reference to the error that occurred.
6. There were no errors reported in the event logs.
7. The grid does show up in the SharePoint designer.

Any thoughts on what else I might want to look at or try to get this working?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 07 May 2009, 03:47 PM
Hello Iomedex,

Could you try removing the rad controls from the sample page and see if the error occurs again. I'd ask you also to send your stack trace and the message in the Windows Event Log under the Application folder.

Thank you.

Best Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Iomedex
Top achievements
Rank 1
answered on 07 May 2009, 04:21 PM
Thanks for getting back to me. When the grid is removed, the page displays as expected. There are no events in the event log.

Are there any other steps that I'm missing?
0
Tsvetoslav
Telerik team
answered on 08 May 2009, 01:52 PM
Hi Iomedex,

Thanks for the feedback.

Please, try setting <customErrors mode="Off" /> in web.config and the CallStack="true" property in the <SharePoint><SafeMode> tag in web.config and see what the stack trace shows.


Best Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Iomedex
Top achievements
Rank 1
answered on 08 May 2009, 04:38 PM
Here is the stack trace. I tried it both with the sample page and with the production page and this is the error that was reported.

The control with ID 'grid' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

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: The control with ID 'grid' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The control with ID 'grid' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.]
   Telerik.Web.UI.ScriptRegistrar.GetScriptManager(Control control) +159
   Telerik.Web.UI.RadCompositeDataBoundControl.get_ScriptManager() +16
   Telerik.Web.UI.RadCompositeDataBoundControl.RegisterScriptControl() +13
   Telerik.Web.UI.RadCompositeDataBoundControl.OnPreRender(EventArgs e) +22
   Telerik.Web.UI.RadGrid.OnPreRender(EventArgs e) +55
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
0
Iomedex
Top achievements
Rank 1
answered on 08 May 2009, 04:41 PM
I added the scriptmanager to the page and now it gets this error.

Parser Error Message: The control type 'System.Web.UI.ScriptManager' is not allowed on this page. The type is not registered as safe.

Source Error:

Line 12: 
Line 13: <form id="form1" runat="server">
Line 14: <asp:ScriptManager ID="scriptManager" runat="server" />Line 15: <telerik:RadGrid ID='grid' runat="server" width="500px"></telerik:RadGrid>
Line 16: </form>
0
Iomedex
Top achievements
Rank 1
answered on 08 May 2009, 09:36 PM

We found the resolution on this. There were a number of pieces that needed to be updated.

1. in the web.config, this node needed to be added.
<runtime>

                  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

                                <dependentAssembly>

                                  <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>

                                  <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>    </dependentAssembly>

                                <dependentAssembly>      <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>

                                  <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>    </dependentAssembly>

                  </assemblyBinding>

</runtime>

2. In the web.config the 1.x version of the System.Web.Extensions needed to be added to the SafeControls list
<SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />

3. The script manager needed to be placed directly in the page that was loading the user controls.

Thank you for your help in this matter.

 

Tags
Sharepoint Integration
Asked by
Iomedex
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Iomedex
Top achievements
Rank 1
Share this question
or