NullReferenceException error when using RadScriptManager

10 posts, 0 answers
  1. Arthur
    Arthur avatar
    30 posts
    Member since:
    Apr 2008

    Posted 18 Jul 2008 Link to this post

    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

  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 21 Jul 2008 Link to this post

    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
  3. Arthur
    Arthur avatar
    30 posts
    Member since:
    Apr 2008

    Posted 21 Jul 2008 Link to this post

    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.

    1 <script runat="server"
    2  
    3     Const RoleAndExpertise As String = "Role and Expertise" 
    4  
    5     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
    6         If Not Page.IsPostBack Then 
    7             addTab("Role and Expertise") 
    8             addPageView(RadTabStrip1.FindTabByText(RoleAndExpertise)) 
    9             addTab("Contact") 
    10             addTab("Collaboration") 
    11             addTab("Blog") 
    12             addTab("Personal") 
    13         End If 
    14     End Sub 
    15  
    16     Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated 
    17         Dim userControlName As String = Me.getControlName(e.PageView.ID) 
    18         Dim userControl As Control = Page.LoadControl(userControlName) 
    19         userControl.ID = e.PageView.ID & "_userControl" 
    20         e.PageView.Controls.Add(userControl) 
    21     End Sub 
    22  
    23     Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick 
    24         addPageView(e.Tab) 
    25         e.Tab.PageView.Selected = True 
    26     End Sub 
    27  
    28     Private Sub addTab(ByVal tabName As String) 
    29         Dim tab As RadTab = New RadTab 
    30         tab.Text = tabName 
    31         RadTabStrip1.Tabs.Add(tab) 
    32     End Sub 
    33  
    34    Private Function getControlName(ByVal pageViewID As String) As String 
    35         Dim retVal As String = pageViewID 
    36         Select Case (pageViewID) 
    37             Case RoleAndExpertise 
    38                 retVal = "RoleAndExpertise" 
    39         End Select 
    40  
    41         Return "~/_controltemplates/" + retVal + "Tab.ascx" 
    42     End Function 
    43  
    44     Private Sub addPageView(ByVal tab As RadTab) 
    45         Dim pageView As RadPageView = New RadPageView 
    46         pageView.ID = tab.Text 
    47         RadMultiPage1.PageViews.Add(pageView) 
    48         'pageView.CssClass = "pageView" 
    49         tab.PageViewID = pageView.ID 
    50     End Sub 
    51 </script> 
    52  
    53 <asp:Content contentplaceholderid="PlaceHolderTitleBreadcrumb" runat="server"
    54         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" style="display:block"
    55             <AjaxSettings> 
    56                 <telerik:AjaxSetting AjaxControlID="RadTabStrip1"
    57                     <UpdatedControls> 
    58                         <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> 
    59                         <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
    60                     </UpdatedControls> 
    61                 </telerik:AjaxSetting> 
    62                 <telerik:AjaxSetting AjaxControlID="RadMultiPage1"
    63                     <UpdatedControls> 
    64                         <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" /> 
    65                     </UpdatedControls> 
    66                 </telerik:AjaxSetting> 
    67             </AjaxSettings> 
    68         </telerik:RadAjaxManager> 
    69         <script type="text/javascript"
    70              
    71             function onTabSelecting(sender, args) 
    72             { 
    73                 if (args.get_tab().get_pageViewID()) 
    74                 { 
    75                     args.get_tab().set_postBack(false); 
    76                 } 
    77             } 
    78         </script> 
    79         <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="24px" Width="75px"
    80             <img alt="Loading..." src="images/loading7.gif" /></telerik:RadAjaxLoadingPanel><div
    81         </div> 
    82          <telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelecting="onTabSelecting" Skin="Hay" MultiPageID="RadMultiPage1" SelectedIndex="0"
    83             </telerik:RadTabStrip> 
    84         <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="4px" SelectedIndex="0"
    85         </telerik:RadMultiPage> 
    86 </asp:Content> 


  4. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 23 Jul 2008 Link to this post

    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
  5. Marcel
    Marcel avatar
    48 posts
    Member since:
    Aug 2008

    Posted 02 Feb 2011 Link to this post

    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" />

  6. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 08 Feb 2011 Link to this post

    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.
  7. Marcel
    Marcel avatar
    48 posts
    Member since:
    Aug 2008

    Posted 07 Mar 2011 Link to this post

    Hi Daniel, I still have zero points ... ? :-)
  8. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 09 Mar 2011 Link to this post

    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!
  9. George
    George avatar
    1 posts
    Member since:
    Aug 2012

    Posted 17 Aug 2012 Link to this post

    Hi Arthur,

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

    Thanks

  10. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 22 Aug 2012 Link to this post

    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.
Back to Top