Skip to content

Replies

0
Louis Garrett
Louis Garrett answered on Feb 25, 2011 10:58 AM

I filled a WebDataGrid with a small SQL Server stored proc result set of 61 rows x 79 varchar(max) columns that took 40 seconds to execute from SQL Server Mgmt Studio.  

At first, I got a timeout error on my WebDataGrid page that said, "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I added this code, which FIXED my TimeOut error:

    <script type="text/javascript" language="javascript">

    function pageLoad()

    {

        var grid = $find("WebDataGrid1");

        grid._callbackManager.setTimeout(60000);

 

         //All three of these variations produced the same result: Fixed TimeOut Error; Caused null reference error.

         //$find("<%= WebDataGrid1.ClientID%>")._callbackManager.setTimeout(60000);

        //$find("WebDataGrid1")._callbackManager.setTimeout(60000);

    }

    </script>

 

But now the page throws this error on the .setTimeout line above. "Microsoft JScript runtime error: '_callbackManager' is null or not an object."

 

My page works properly, with no TimeOut or null reference errors, if I surround the .setTimeout line with try{} and an empty catch{}, as shown in the code below.

Why is _callbackManager null at runtime? 

How did this fix my TimeOut Error when _callbackManager was null at runtime?

Thanks.

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"

    CodeFile="DataPointRatioValue.aspx.cs" Inherits="Grids_DataPointRatioValue" %>

<%@ Register Assembly="Infragistics4.WebUI.WebResizingExtender.v10.3, Version=10.3.20103.2073, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.WebUI" TagPrefix="igui" %>

<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.2073, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>

<%@ Register Assembly="Infragistics4.WebUI.WebDataInput.v10.3, Version=10.3.20103.2073, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %>

<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.2073, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.Web.UI.ListControls" TagPrefix="ig" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">

    <script type="text/javascript" language="javascript">

        function pageLoad()

        {

            try

            {

                var grid = $find("WebDataGrid1");

                grid._callbackManager.setTimeout(60000);

 

                //$find("<%= WebDataGrid1.ClientID%>")._callbackManager.setTimeout(60000);

                //$find("WebDataGrid1")._callbackManager.setTimeout(60000);

            }

            catch (e)

            {

                //catch and just suppress error

            }

        }

    </script>

    <table runat="server" cellpadding="5" cellspacing="2">

        <tr>

            <td align="left" colspan="4">

                <asp:Label runat="server" Font-Size="Larger" ID="lblMessage" ForeColor="Maroon"></asp:Label>

            </td>

        </tr>

        <tr>

            <td align="left">

                <ig:WebDropDown ID="ddlDataPointValueSet" runat="server" Width="411px" DropDownContainerWidth="544px"

                    DataKeyFields="DataPointValueSetID" DataSourceID="dSrc_DataPointValueSet" TextField="Name"

                    ValueField="DataPointValueSetID" EnableLoadOnDemand="True" EnableMultipleSelection="True"

                    EnableClosingDropDownOnSelect="False">

                    <DropDownItemBinding TextField="Name" ValueField="DataPointValueSetID" />

                </ig:WebDropDown>

            </td>

            <td align="left">

                <ig:WebDropDown ID="ddlCategory" runat="server" Width="411px" DropDownContainerWidth="544px"

                    DataKeyFields="SubCategoryID" TextField="Category" ValueField="SubCategoryID"

                    EnableLoadOnDemand="True" EnableMultipleSelection="True" DataSourceID="dSrc_Category"

                    EnableClosingDropDownOnSelect="False">

                    <DropDownItemBinding TextField="Category" ValueField="SubCategoryID" />

                </ig:WebDropDown>

            </td>

            <td align="left">

                <igtxt:WebImageButton ID="WebImageButton1" runat="server" Text="Show" AccessKey="w"

                    UnderlineAccessKey="true" OnClick="WebImageButton1_Click" ClickOnEnterKey="true">

                </igtxt:WebImageButton>

            </td>

            <td align="left">

                <igtxt:WebImageButton ID="WebImageButton3" runat="server" Text="Export" AccessKey="x"

                    OnClick="WebImageButton3_Click">

                </igtxt:WebImageButton>

            </td>

        </tr>

    </table>

    <igui:WebResizingExtender ID="WebResizingExtender1" runat="server" TargetControlID="WebDataGrid1" />

    <ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="444px" Width="100%" DataSourceID="dSrc_DataPointRatioValue"

        Visible="False" EnableDataViewState="false">

        <Behaviors>

            <ig:ColumnResizing>

            </ig:ColumnResizing>

            <ig:Filtering>

            </ig:Filtering>

            <ig:VirtualScrolling>

            </ig:VirtualScrolling>

            <ig:Sorting>

            </ig:Sorting>

        </Behaviors>

    </ig:WebDataGrid>

    <ig:WebExcelExporter runat="server" ID="WebExcelExporter1" ExportMode="Download" />

    <asp:SqlDataSource ID="dSrc_DataPointRatioValue" runat="server" ConnectionString="<%$ ConnectionStrings:dbExcelConnectionString %>"

        SelectCommand="usp_Select_Scorecard_Data" SelectCommandType="StoredProcedure">

        <SelectParameters>

            <asp:Parameter Name="DataPointValueSetIDList" Type="String" />

            <asp:Parameter Name="SubCategoryIDList" Type="String" />

        </SelectParameters>

    </asp:SqlDataSource>

    <asp:SqlDataSource ID="dSrc_DataPointValueSet" runat="server" ConnectionString="<%$ ConnectionStrings:dbExcelConnectionString %>"

        SelectCommand="usp_Select_List_DataPoint_Value_Set" SelectCommandType="StoredProcedure">

        <SelectParameters>

            <asp:Parameter DefaultValue="False" Name="AddNullRow" Type="Boolean" />

        </SelectParameters>

    </asp:SqlDataSource>

    <asp:SqlDataSource ID="dSrc_Category" runat="server" ConnectionString="<%$ ConnectionStrings:dbExcelConnectionString %>"

        SelectCommand="usp_Select_Category" SelectCommandType="StoredProcedure"></asp:SqlDataSource>

</asp:Content>