Microsoft JScript runtime error: '_events' is null or not an object with RadGrid

13 posts, 0 answers
  1. Reena
    Reena avatar
    6 posts
    Member since:
    Jul 2010

    Posted 22 Jul 2010 Link to this post

    Hi,
    I am using RadGrid with RadFilter. Everything works fine, after I select some data to filter and apply the filter if I close the browser after that I get the "Microsoft JScript runtime error: '_events' is null or not an object" error somewhere in Telerix.web.ui

    aspx file:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default14.aspx.cs" Inherits="Default14" %>
      
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
        <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
      
        <script type="text/javascript">
            //
            function openFilterBuilderDialog() {
                $find('<%=RadWindow1.ClientID %>').show();
            }
      
            function hideFilterBuilderDialog() {
                $find('<%=RadWindow1.ClientID %>').close();
            }
      
            function OnHeaderMenuItemClicked(sender, args)
            {
                if (args.get_item().get_value() == "FilterBuilder")
                {
                    openFilterBuilderDialog();
                }
            }
      
            function onPanelBarItemClicked(sender, args)
            {
                if (args.get_item().get_commandName() == "OpenRadFilter")
                {
                    openFilterBuilderDialog();
                }
            }
        </script>
      
    </telerik:RadScriptBlock>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
          
        <asp:Button ID="Button1" runat="server" Text="Refresh" OnClick="Button1_Click" />
          
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadFilter1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadFilter1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="ApplyButton">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
            <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Move,Close,Resize" Title="Filter Builder"
                Modal="true" Width="500" Height="350">
                <ContentTemplate>
                    <telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="RadGrid1" ShowApplyButton="false" style="margin:10px 0 0 10px"/>
                    <asp:Panel ID="FilterButtonPanel" runat="server" style="margin:10px 0 0 10px;font-size:medium">
                        <asp:LinkButton runat="server" ID="ApplyButton" OnClick="ApplyButton_Click" Font-Names="Verdana" Font-Size="Small"
                        Text="Apply Expressions" OnClientClick="hideFilterBuilderDialog()"/>
                    </asp:Panel>
                </ContentTemplate>
            </telerik:RadWindow>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="5" 
            AllowSorting="true" OnItemCommand="RadGrid1_ItemCommand" 
            AllowFilteringByColumn="True">
            <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID" IsFilterItemExpanded ="false" CommandItemDisplay="Top">
                <CommandItemTemplate>
                        <telerik:RadToolBar runat="server" ID="RadToolBar1" OnClientButtonClicked="onPanelBarItemClicked">
                            <Items>
                                <telerik:RadToolBarButton Text="Show filter" CommandName="OpenRadFilter" ImageUrl="<%#GetFilterIcon() %>"
                                    ImagePosition="Right"/>
                            </Items>
                        </telerik:RadToolBar>
                    </CommandItemTemplate>
                    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <PagerStyle Mode="NumericPages" />
    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" ReadOnly="true" HeaderButtonType="None">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description">
                    </telerik:GridBoundColumn>                
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>    
          
        </form>
    </body>
    </html>

    cs code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
      
    public partial class Default14 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
      
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            RadGrid1.DataSource = Data ;
            RadGrid1.DataBind();
        }
        protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.PageCommandName)
            {
                e.Item.OwnerTableView.CurrentPageIndex = (e as GridPageChangedEventArgs).NewPageIndex;
                RadGrid1.DataSource = Data;
                RadGrid1.DataBind();
            }
            if (e.CommandName == RadGrid.SortCommandName)
            {
                RadGrid1.DataSource = Data ;
                RadGrid1.DataBind();
            }
        }
        public DataTable Data
        {
            get
            {
                if (Session["Data"] == null)
                {
                    DataTable table = new DataTable();
                    table.Columns.Add("ID");
                    table.Columns.Add("Description");
                    for (int i = 0; i < 10; i++)
                    {
                        table.Rows.Add(i, "Description" + i.ToString());
                    }
                    Session["Data"] = table;
                }
                return (DataTable)Session["Data"];
            }
            set
            {
                Session["Data"] = value;
            }
        }
        protected string GetFilterIcon()
        {
            //RadGrid1.Skin = RadSkinManager1.Skin ;
            //RadGrid1.Rebind();
      
            return RadAjaxLoadingPanel.GetWebResourceUrl(Page, string.Format("Telerik.Web.UI.Skins.{0}.Grid.Filter.gif", "Vista"));
        }
        protected void ApplyButton_Click(object sender, EventArgs e)
        {
            RadFilter1.FireApplyCommand();
            RadGrid1.DataSource = Data ;
            RadGrid1.Rebind();
        }
    }

    Please advise what is wrong here.

    Thanks,
    Reena
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 28 Jul 2010 Link to this post

    Hello Reena,

    The problem is caused because of RadWindow.ContentTemplate. We are already working on resolving the issue, unfortunately we will need a bit more time.

    I will update this thread as soon as we have proper solution available.

    Best wishes,
    Nikolay
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Reena
    Reena avatar
    6 posts
    Member since:
    Jul 2010

    Posted 02 Aug 2010 Link to this post

    Hi,
    Thanks.
    Is there any work around for this problem.

    Reena
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 05 Aug 2010 Link to this post

    Hello Reena,

    You can try latest internal build. The issue should be resolved.

    Regards,
    Nikolay
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Joe
    Joe avatar
    13 posts
    Member since:
    Jul 2010

    Posted 23 Aug 2010 Link to this post

    I have the same issue.  Where would I pull the latest internal build?  Also, what's the schedule to fix this issue in a formal build?
  7. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 26 Aug 2010 Link to this post

    Hello Joe,

    Here you can download Latest Internal Builds. Officially the fix will be available in the upcoming SP1 of RadControls for ASP.NET AJAX.

    All the best,
    Nikolay
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  8. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 04 Nov 2010 Link to this post

    We ran into this error today as well.  We are using version 2010.2.929.40.

    In our case we are using a prototype to use RadToolTips as a ValidationExtender.  On the initialize we call $addHandler to bind a focus and blur handlers and in the dispose we call $removeHandler to get rid of them.

    Putting the $removeHandler in a try|catch solved the problem.  Eventually we may look into a more elegant way to handle this problem but it works for now.  When checked, this._elementToValidate and this._focusHandler/this._blurHandler were != null.

    Note: The $removeHandler only failed and threw this error when the control to be validated was in a Telerik control template.  Potentially this problem is still not completely resolved as of SP1.

    dispose: function () {
        this._tooltipManager = null;
        try {
            $removeHandler(this._elementToValidate, 'focus', this._focusHandler);
            $removeHandler(this._elementToValidate, 'blur', this._blurHandler);
        }
        catch (ex) {
            // eat me!
        }

  9. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 09 Nov 2010 Link to this post

    Hi Thad,

     The ajax client error when using $removeHandler occurs in some standard scenarios, e.g when you try to remove the handler and it for some reason has become null, etc. There are many related posts on the net, e.g below:

    http://www.google.bg/#q=%24removeHandler+error+ajax&hl=bg&rlz=1W1ADFA_en&ei=cRPZTOCeOYiN4Abq6qCYCQ&start=10&sa=N&fp=5c415c10e0469431

    What I can suggest is to test the following approaches:

    1) Use $clearHandlers syntax as shown below:

    dispose: function () {
        this._tooltipManager = null;
         $clearHandlers(this._elementToValidate);
        }

    2) If you use the $removeHandler you can test whether adding the check for null helps:

    dispose: function () {
        this._tooltipManager = null;
        if(this._focusHandler)
            $removeHandler(this._elementToValidate, 'focus', this._focusHandler);
         if(this._blurHandler)
            $removeHandler(this._elementToValidate, 'blur', this._blurHandler);
     }

    I assume that the problem is not directly related to RadControls but if you want us to investigate what is the exact case we will be glad to do this for you but we will need a sample, fully runnable reproduction demo. Please, provide such and we will do our best to help.

    Regards,
    Svetlina
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  10. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    Hi Svetlina,

    We tried option #2, but that still failed.  I'll try option #1 you provide to see if that solves the problem.

    If it doesn't, then I'll try to get a stand-alone app built to demonstrate the problem and I'll submit a support ticket and reference that support id here for you.

    Thanks!
    Thad
  11. Kedar
    Kedar avatar
    4 posts
    Member since:
    Dec 2010

    Posted 09 Dec 2010 Link to this post

    Hi Telerik team,

    We are using the RadGrid in RadWindow to show the records. When we select some record from the radgrid, the selected item should be shown in textbox. But, when we navigate through different pages in radgird, or filter operation is done, we get error, "Microsoft JScript runtime error: '_events' is null or not an object with RadGrid".
    Can we override this error by handling this exception?
    Let us know on the earliest.
    Kedar
  12. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 09 Dec 2010 Link to this post

    Hi Kedar,

    This is a known issue in a previous version of our AJAX suite and should be addressed in version Q2 2010 SP1 (2010.2.826) of the controls or later. Can you please check what your version is and upgrade it (following the steps from here) if necessary? Let us know how it goes.

    Best regards,
    Sebastian
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
  13. Kedar
    Kedar avatar
    4 posts
    Member since:
    Dec 2010

    Posted 09 Dec 2010 Link to this post

    Thanks Sebestian. I had installed the said version - Q2 2010 SP1 (2010.2.826).
    But the dll version was different. Its working now. Thanks a lot.
    Rergards,
    Kedar
  14. Rick Borage
    Rick Borage avatar
    5 posts
    Member since:
    Mar 2010

    Posted 24 Mar 2011 Link to this post

    I had a similar issue, only here is the deal, I was getting this message about a RadComboBox that was in a user control that was being referenced on a page inside of an asp:UpdatePanel - ContentTemplate.

    After four hours of troubleshooting, simply removing the UpdatePanel from the main page fixed the problem.  I already had a RadAjaxPanel in the user control.

    Hope that helps somebody. 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017