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

Script error with paginated RadGrid in MOSS 2007

1 Answer 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 2
Chris asked on 19 Apr 2010, 03:37 PM
Hi,
 I have a script error happening only in a very specific set of circumstances in a webpart in MOSS 2007 SP1 since I upgraded to Q1 2010.

I have an hierarcial Rad Grid that works correctly until the master table requires pagination, then I get a script error part way through the ajax request and the page hangs and does not recover.

The error is as below:
Webpage error details 
 
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; InfoPath.2; .NET4.0C; .NET4.0E) 
Timestamp: Mon, 19 Apr 2010 13:55:36 UTC 
 
 
Message: Object doesn't support this property or method 
Line: 827 
Char: 32 
Code: 0 
URI: http://portal.eastbourne-college.co.uk/ScriptResource.axd?d=txQS_34g4oX2-DztPEESENt3RtxUORct0OjIfAJgFWNNLtYZW5oja4jdvk773UqBatOLP9kNfvljXhYOe_gC4SY_QjcWJMkoox23HN8ePFp6C8NiAIn_8RrH1i_Msgqj0&t=634054532715333782 
 

The line in the js file that causes the problem is :
if(this._disposeChildElements){$telerik.disposeElement(c); 

This was all working correctly with the previous version that I was using (2009.2.826.20). As a note the child grids needing pagination does not cause an error only the master table. Please see below for the code for the contol. 

Markup:
<%@ Control Language="C#" AutoEventWireup="true"  
        CodeFile="QuickBudgetView.ascx.cs"  
        Inherits="usercontrols_quickbudgetview" %> 
         
<%@ Register assembly="Telerik.Web.UI, Version=2010.1.309.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"  
        namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<%@ Register assembly="AjaxControlToolkit, Version=1.0.20229.25335, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"  
        namespace="AjaxControlToolkit" tagprefix="cc1" %> 
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server" > 
    <script type="text/javascript"
        function showFilterItem() { 
            $find('<%=rgBudgets.ClientID %>').get_masterTableView().showFilterItem(); 
        } 
        function hideFilterItem() { 
            $find('<%=rgBudgets.ClientID %>').get_masterTableView().hideFilterItem(); 
        }  
    </script> 
 </telerik:RadCodeBlock> 
  
<telerik:RadAjaxManagerProxy runat="server" ID="rampChild" > 
</telerik:RadAjaxManagerProxy> 
 
<telerik:RadAjaxLoadingPanel Runat="server" height="75px" width="75px"  
    ID="alpMain" Transparency="20" BackColor="White"  
    HorizontalAlign="Center" > 
    <br /> 
    <br /> 
    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
        style="border: 0px;" /> 
</telerik:RadAjaxLoadingPanel> 
 
  <span class="ec-smartpart" >               
        <div> 
            Show filters <input id="Radio1" type="radio" runat="server" name="showHideGroup"  onclick="showFilterItem()" /><label for="Radio1">Yes</label>  
            <input id="Radio2" type="radio" runat="server" name="showHideGroup" onclick="hideFilterItem()" checked="true"/><label for="Radio2" >No</label> 
        </div> 
        <br/> 
<div class="filterDiv"
            <telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="rgBudgets" ShowApplyButton="false" /> 
        </div> 
 
    <telerik:RadGrid ID="rgBudgets" runat="server" AllowPaging="True" AllowSorting="True"  
    AutoGenerateColumns="False" DataSourceID="dsBudgetSummary" GridLines="None"  
    Skin="Sunset" PageSize="15" onitemdatabound="rgBudgets_ItemDataBound"  
        onitemcommand="RadGrid1_ItemCommand" > 
<HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu> 
<PagerStyle Mode="NextPrevAndNumeric" /> 
<MasterTableView DataSourceID="dsBudgetSummary" DataKeyNames="SUMMARY_ID" IsFilterItemExpanded="false" CommandItemDisplay="Top"
<CommandItemTemplate> 
                    <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick"
                        <Items> 
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid" ImageUrl="<%#GetFilterIcon() %>" 
                                ImagePosition="Right" /> 
                        </Items> 
                    </telerik:RadToolBar> 
                </CommandItemTemplate> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
<DetailTables> 
    <telerik:GridTableView DataKeyNames="SUMMARY_ID" DataSourceID="dsBudgetDetails" 
    Width="100%" runat="server"  Name="BudgetDetails" ShowHeader="true" PageSize="25" > 
    <ParentTableRelation> 
        <telerik:GridRelationFields DetailKeyField="SUMMARY_ID" MasterKeyField="SUMMARY_ID" /> 
    </ParentTableRelation> 
    <Columns> 
        <telerik:GridBoundColumn DataField="TRANSACTION_ID" UniqueName="TRANSACTION_ID" Visible="false"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="SUMMARY_ID" HeaderText="SUMMARY_ID"  
            ReadOnly="True" SortExpression="SUMMARY_ID" UniqueName="SUMMARY_ID"  
            Visible="False"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="TRANSACTION_DATE" UniqueName="TRANSACTION_DATE"  
            HeaderText="Date" DataFormatString="{0:dd/MM/yy}" Visible="true"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ACCOUNT_CODE" HeaderText="Account"  
            SortExpression="ACCOUNT_CODE" UniqueName="ACCOUNT_CODE"
            <HeaderStyle Width="60px" Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DEPARTMENT_CODE" HeaderText="Dept"  
            SortExpression="DEPARTMENT_CODE" UniqueName="DEPARTMENT_CODE"
            <HeaderStyle Width="60px" Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="REFERENCE_1" HeaderText="Ref 1"  
            SortExpression="REFERENCE_1" UniqueName="REFERENCE_1"
            <HeaderStyle Width="60px" Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="REFERENCE_2" HeaderText="Ref 2"  
            SortExpression="REFERENCE_2" UniqueName="REFERENCE_2"
            <HeaderStyle Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="TRANSACTION_VALUE" DataType="System.Decimal"  
            HeaderText="Value" ReadOnly="True" SortExpression="TRANSACTION_VALUE" 
            UniqueName="TRANSACTION_VALUE" DataFormatString="{0:C}" AllowFiltering="False"
            <HeaderStyle Width="60px" /> 
            <ItemStyle HorizontalAlign="Right" /> 
        </telerik:GridBoundColumn> 
    </Columns> 
    </telerik:GridTableView> 
    </DetailTables> 
 
    <Columns> 
        <telerik:GridBoundColumn DataField="SUMMARY_ID" HeaderText="SUMMARY_ID"  
            ReadOnly="True" SortExpression="SUMMARY_ID" UniqueName="SUMMARY_ID"  
            Visible="False"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ACCOUNT_CODE" HeaderText="Account"  
            SortExpression="ACCOUNT_CODE" UniqueName="ACCOUNT_CODE"
            <HeaderStyle Width="60px" Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DEPT_CODE" HeaderText="Dept"  
            SortExpression="DEPT_CODE" UniqueName="DEPT_CODE"
            <HeaderStyle Width="60px" Wrap="true" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="Description"  
            ReadOnly="True" SortExpression="DESCRIPTION" UniqueName="DESCRIPTION"  
            AllowFiltering="False"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BUDGET" DataType="System.Decimal"  
            HeaderText="Budget" ReadOnly="True" SortExpression="BUDGET" 
            UniqueName="BUDGET" DataFormatString="{0:C}" AllowFiltering="False"
            <HeaderStyle Width="60px" /> 
            <ItemStyle HorizontalAlign="Right" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BALANCE" DataType="System.Decimal"  
            HeaderText="Balance" ReadOnly="True" SortExpression="BALANCE" 
            UniqueName="BALANCE" DataFormatString="{0:C}" AllowFiltering="False"
            <HeaderStyle Width="60px" /> 
            <ItemStyle HorizontalAlign="Right" /> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BUDGET_REMAINING" DataType="System.Decimal"  
            HeaderText="Budget Remaining" ReadOnly="True" SortExpression="BUDGET_REMAINING"  
            UniqueName="BUDGET_REMAINING" DataFormatString="{0:C}"  
            AllowFiltering="False"
            <HeaderStyle Width="60px" Wrap="true" /> 
            <ItemStyle HorizontalAlign="Right" /> 
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
    </telerik:RadGrid> 
</span> 
 
<asp:SqlDataSource ID="dsBudgetSummary" runat="server"  
    ConnectionString="<%$ ConnectionStrings:PassMainConnectionString %>"  
    SelectCommand="usps_GetBudgetSummary" SelectCommandType="StoredProcedure"  
    onselecting="dsBudgetSummary_Selecting"
    <SelectParameters> 
        <asp:Parameter DefaultValue="xxxx" Name="loginName" Type="String" /> 
    </SelectParameters> 
</asp:SqlDataSource> 
<asp:SqlDataSource ID="dsBudgetDetails" runat="server"  
    ConnectionString="<%$ ConnectionStrings:PassMainConnectionString %>"  
    SelectCommand="usps_GetBudgetDetail" SelectCommandType="StoredProcedure"  
    onselecting="dsBudgetDetails_Selecting"
    <SelectParameters> 
        <asp:Parameter Name="SUMMARY_ID" Type="String" /> 
        <asp:Parameter Name="loginName" Type="String" /> 
    </SelectParameters> 
</asp:SqlDataSource> 
 

Code Behind:
#region Imports 
 
using System; 
using System.Data; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Drawing; 
using System.Globalization; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Microsoft.SharePoint; 
using Telerik.Web.UI; 
using EastbourneCollege.Global; 
#endregion 
 
[Description("Quick Budget View")] 
public partial class usercontrols_quickbudgetview : System.Web.UI.UserControl 
    private SPUser _user; 
    private SPWeb _web; 
 
    protected override void OnInit(EventArgs e) 
    { 
        base.OnInit(e); 
        Page.ClientScript.RegisterStartupScript(typeof(usercontrols_quickbudgetview), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;"true); 
        if (this.Page.Form != null
        { 
            string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"]; 
            if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();"
            { 
                this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();"
            } 
        } 
    } 
 
    protected override void OnPreRender(EventArgs e) 
    { 
        base.OnPreRender(e); 
        RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(rgBudgets,rgBudgets,alpMain); 
    } 
 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "FilterRadGrid"
        { 
            RadFilter1.FireApplyCommand(); 
        } 
    } 
 
    protected void Header1_SkinChanged(object sender, SkinChangedEventArgs e) 
    { 
        //Required for dynamic skin changing 
        rgBudgets.Rebind(); 
    } 
 
    protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) 
    { 
        // 
    } 
 
    protected string GetFilterIcon() 
    { 
        return RadAjaxLoadingPanel.GetWebResourceUrl(Page, string.Format("Telerik.Web.UI.Skins.{0}.Grid.Filter.gif",rgBudgets.SkinID)); 
    } 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
        _web = SPContext.Current.Web; 
        _user = _web.CurrentUser; 
 
 
        if (Page.IsPostBack) return
        EnsureChildControls(); 
        DataBind(); 
    } 
    protected void dsBudgetSummary_Selecting(object sender, SqlDataSourceSelectingEventArgs e) 
    { 
        e.Command.Parameters["@loginName"].Value = _user.LoginName;// @"epcot\cjg"; 
    } 
    protected void dsBudgetDetails_Selecting(object sender, SqlDataSourceSelectingEventArgs e) 
    { 
        e.Command.Parameters["@loginName"].Value = _user.LoginName;// @"epcot\cjg"; 
    } 
    protected void rgBudgets_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        //Is it a GridDataItem 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name!="BudgetDetails"
        { 
            //Get the instance of the right type 
            GridDataItem dataBoundItem = e.Item as GridDataItem; 
 
            //Check the formatting condition 
            if (double.Parse(dataBoundItem["BUDGET_REMAINING"].Text,NumberStyles.Any) < 0) 
            { 
                dataBoundItem["BUDGET_REMAINING"].ForeColor = Color.Red; 
                dataBoundItem["BUDGET_REMAINING"].Font.Bold = true
            } 
        } 
    } 
 
         


Thanks

Chris



1 Answer, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 2
answered on 21 Apr 2010, 04:26 PM
SP1 fixed it v 2010.1.415

Thanks

Chris
Tags
Ajax
Asked by
Chris
Top achievements
Rank 2
Answers by
Chris
Top achievements
Rank 2
Share this question
or