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

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

12 Answers 298 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reena
Top achievements
Rank 1
Reena asked on 22 Jul 2010, 06:47 PM
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

12 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 28 Jul 2010, 11:30 AM
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
0
Reena
Top achievements
Rank 1
answered on 02 Aug 2010, 02:33 PM
Hi,
Thanks.
Is there any work around for this problem.

Reena
0
Nikolay Rusev
Telerik team
answered on 05 Aug 2010, 09:45 AM
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
0
Joe
Top achievements
Rank 1
answered on 23 Aug 2010, 07:19 PM
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?
0
Nikolay Rusev
Telerik team
answered on 26 Aug 2010, 09:39 AM
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
0
Thad
Top achievements
Rank 2
answered on 04 Nov 2010, 05:11 PM
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!
    }

0
Svetlina Anati
Telerik team
answered on 09 Nov 2010, 12:03 PM
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
0
Thad
Top achievements
Rank 2
answered on 11 Nov 2010, 07:35 PM
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
0
Kedar
Top achievements
Rank 1
answered on 09 Dec 2010, 08:53 AM
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
0
Sebastian
Telerik team
answered on 09 Dec 2010, 09:52 AM
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.
0
Kedar
Top achievements
Rank 1
answered on 09 Dec 2010, 12:59 PM
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
0
Rick Borage
Top achievements
Rank 1
answered on 24 Mar 2011, 10:59 PM
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. 
Tags
Grid
Asked by
Reena
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Reena
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Thad
Top achievements
Rank 2
Svetlina Anati
Telerik team
Kedar
Top achievements
Rank 1
Sebastian
Telerik team
Rick Borage
Top achievements
Rank 1
Share this question
or