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

Filter JS Error with 2010.1 + .NET 4.0 + MasterPage + AjaxManager

2 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
theksmith
Top achievements
Rank 1
theksmith asked on 05 Apr 2010, 08:41 PM
Using RadGrid in version 2010.1.309 or 2010.1.329 and .NET 4.0:

Receive a JS Error when attempting to submit a column filter when using a MasterPage and AjaxManager with the RadGrid. Removing AjaxManager or MasterPage features fixes problem.


JS Error:
Message: 'get_postBackElement().id' is null or not an object
Line: 9239
Char: 1
Code: 0
URI: http://localhost:35519/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ContentPlaceHolder1_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a00000000-0000-0000-0000-000000000000%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3ab5c33bd3-ea2e-4bfa-bdd0-3d7cef59d2be%3a16e4e7cd%3af7645509%3a22a6274a%3a58366029%3a24ee1bba%3ae330518b%3a1e771326%3ac8618e41%3ae4f8f289%3aed16cbdc

To Recreate...

Site1.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="RadGridAjaxFilterError.Site1" %> 
<%@ 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"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"></head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"
         
        </asp:ContentPlaceHolder> 
    </div> 
    </form> 
</body> 
</html> 
 

WebForm2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="RadGridAjaxFilterError.WebForm2" MasterPageFile="~/Site1.Master" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        <Scripts> 
            <%--Needed for JavaScript IntelliSense in VS2010--%> 
            <%--For VS2008 replace RadScriptManager with ScriptManager--%> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> 
        </Scripts> 
    </telerik:RadScriptManager> 
 
    With Master Page, No RadAjaxManager, Filter works: 
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateColumns="false" Width="200"
        <MasterTableView> 
            <Columns> 
                <telerik:GridBoundColumn DataField="Field1" AutoPostBackOnFilter="True"
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
 
    <br /> 
 
    <span style="color:#A00">With Master Page, With RadAjaxManager, Filter does NOT work (JS error):</span> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid2"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"
    </telerik:RadAjaxLoadingPanel> 
 
    <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateColumns="false" Width="200"
        <MasterTableView> 
            <Columns> 
                <telerik:GridBoundColumn DataField="Field1" AutoPostBackOnFilter="True"
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
</asp:Content> 
 

WebForm2.aspx.cs
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data; 
 
using Telerik.Web.UI; 
 
namespace RadGridAjaxFilterError 
    public partial class WebForm2 : System.Web.UI.Page 
    { 
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
            RadGrid grid = (RadGrid)source; 
 
            DataTable t = new DataTable(); 
 
            t.Columns.Add("Field1"); 
 
            t.Rows.Add("111"); 
            t.Rows.Add("222"); 
            t.Rows.Add("333"); 
            t.Rows.Add("444"); 
 
            grid.DataSource = t; 
        } 
    } 














2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel
Telerik team
answered on 06 Apr 2010, 12:32 PM
Hello,

Please check the following thread which discusses the same problem which is caused by a bug in the .Net 4.0 Framework. You can try the workaround suggested there as a temporary solution. I can also inform you that the issue in the Framework is addressed and the problem will not appear with its final version.

Kind regards,
Pavel
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
theksmith
Top achievements
Rank 1
answered on 06 Apr 2010, 06:03 PM
Thanks! Indeed, setting the ClientIDMode property to "AutoID" within the @Page Directive solved the issue.
Tags
Grid
Asked by
theksmith
Top achievements
Rank 1
Answers by
Pavel
Telerik team
theksmith
Top achievements
Rank 1
Share this question
or