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

NullReferenceException error when using RadScriptManager

9 Answers 387 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arthur
Top achievements
Rank 2
Arthur asked on 18 Jul 2008, 03:07 PM

Hi,

    I've been encountering a problem when I use RadScriptManager. In the master page, I registered the Telerik.Web.UI and added the RadScriptManager.

<%@ Register Assembly="Telerik.Web.UI, Version=2008.1.619.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 

and added the RadScriptManager:

<telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True"/>  

But when I try to use this master page, I get an error. The error says:

NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.WebResource.Exists(String path, String applicationPath) +257
   Telerik.Web.UI.RadScriptManager.OnPreRender(EventArgs e) +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


I am not sure what the problem is or where to start looking. I tried removing the RadScriptManager and use <asp:ScriptManager> instead and the error is gone. Can somebody help me with this?

Thank you!


Regards,
Francis

9 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jul 2008, 08:27 AM
Hi Francis,

You need to register the httpHandler of RadScriptManager inside the httphandler section of web.config. You should click on the smart tag of the RadScriptManager and select Register Telerik.Web.UI.WebResource.axd.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Arthur
Top achievements
Rank 2
answered on 21 Jul 2008, 01:26 PM
Hi Daniel,

Thank you for the reply. I did register the RadScriptManager in the httphandler but I registered the wrong version. I didn't get the error anymore although the I am getting a weird behavior of the control.

The control is not displaying in my page although when I try a View Source of my page, I can see that the control was rendered in the page. But they have a "none" value in the display property. We didn't set anything in the code but I keep on getting this value even when I try to add 'style="display:none;" in the control.

<span id="ctl00_PlaceHolderTitleBreadcrumb_RadAjaxManager1" style="display:none;"></span>

<div id="ctl00_PlaceHolderTitleBreadcrumb_RadAjaxLoadingPanel1" style="display:none;height:24px;width:75px;"


This is my code in my aspx page.

<script runat="server"
 
    Const RoleAndExpertise As String = "Role and Expertise" 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
        If Not Page.IsPostBack Then 
            addTab("Role and Expertise") 
            addPageView(RadTabStrip1.FindTabByText(RoleAndExpertise)) 
            addTab("Contact") 
            addTab("Collaboration") 
            addTab("Blog") 
            addTab("Personal") 
        End If 
    End Sub 
 
    Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated 
        Dim userControlName As String = Me.getControlName(e.PageView.ID) 
        Dim userControl As Control = Page.LoadControl(userControlName) 
        userControl.ID = e.PageView.ID & "_userControl" 
        e.PageView.Controls.Add(userControl) 
    End Sub 
 
    Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick 
        addPageView(e.Tab) 
        e.Tab.PageView.Selected = True 
    End Sub 
 
    Private Sub addTab(ByVal tabName As String) 
        Dim tab As RadTab = New RadTab 
        tab.Text = tabName 
        RadTabStrip1.Tabs.Add(tab) 
    End Sub 
 
   Private Function getControlName(ByVal pageViewID As String) As String 
        Dim retVal As String = pageViewID 
        Select Case (pageViewID) 
            Case RoleAndExpertise 
                retVal = "RoleAndExpertise" 
        End Select 
 
        Return "~/_controltemplates/" + retVal + "Tab.ascx" 
    End Function 
 
    Private Sub addPageView(ByVal tab As RadTab) 
        Dim pageView As RadPageView = New RadPageView 
        pageView.ID = tab.Text 
        RadMultiPage1.PageViews.Add(pageView) 
        'pageView.CssClass = "pageView" 
        tab.PageViewID = pageView.ID 
    End Sub 
</script> 
 
<asp:Content contentplaceholderid="PlaceHolderTitleBreadcrumb" runat="server"
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" style="display:block"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadTabStrip1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> 
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="RadMultiPage1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <script type="text/javascript"
             
            function onTabSelecting(sender, args) 
            { 
                if (args.get_tab().get_pageViewID()) 
                { 
                    args.get_tab().set_postBack(false); 
                } 
            } 
        </script> 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="24px" Width="75px"
            <img alt="Loading..." src="images/loading7.gif" /></telerik:RadAjaxLoadingPanel><div
        </div> 
         <telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelecting="onTabSelecting" Skin="Hay" MultiPageID="RadMultiPage1" SelectedIndex="0"
            </telerik:RadTabStrip> 
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="4px" SelectedIndex="0"
        </telerik:RadMultiPage> 
</asp:Content> 


0
Daniel
Telerik team
answered on 23 Jul 2008, 10:39 AM
Hi Francis,

Please check if the attached project (build over your code) represents the desired behavior. I hope this helps!

Regards,
Daniel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Marcel
Top achievements
Rank 1
answered on 02 Feb 2011, 09:34 PM

There is a minor error in the documentation located at: http://www.telerik.com/help/aspnet-ajax/moss-deploying-radcontrols.html section 3: IIS6,etc.
Line:

<add path="Telerik.Web.UI.WebResource.axd"verb="*"type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />

 

you get:
Unhandled Exception caught: System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Web.UI.WebResource.Exists(HttpContext context, String path, String applicationPath) at Telerik.Web.UI.RadScriptManager.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The following line works outside of SharePoint in a separate web app, but gave me  401s in the IIS log for SharePoint web app and the controls did not work - RadTextBox did not retain postback values, radcombobox did not ropdown): 

<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />

For it to work in SharePoint, it should be: (avoid 401s in IIS Log) 

<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2010.3.1317.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />

0
Daniel
Telerik team
answered on 08 Feb 2011, 10:59 PM
Hello Marcel,

Thank you for your suggestion. As a sign of gratitude I updated your Telerik points.

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
Marcel
Top achievements
Rank 1
answered on 07 Mar 2011, 08:27 PM
Hi Daniel, I still have zero points ... ? :-)
0
Daniel
Telerik team
answered on 09 Mar 2011, 09:53 PM
Hello Marcel,

My bad - sorry for that. Your points are updated now.

Best regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
George
Top achievements
Rank 1
answered on 17 Aug 2012, 06:21 AM

Hi Arthur,

Am having the same problems, how did you solve it?

Thanks

0
Daniel
Telerik team
answered on 22 Aug 2012, 09:02 AM
Hello George,

Please verify whether the http handler is registered correctly in the web.config file.
For more information, examine the following topic:
RadScriptManager

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.
Tags
General Discussions
Asked by
Arthur
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Arthur
Top achievements
Rank 2
Marcel
Top achievements
Rank 1
George
Top achievements
Rank 1
Share this question
or