Error: Unable to get property 'Cols' of undefined or null reference

4 posts, 0 answers
  1. Chuck
    Chuck avatar
    18 posts
    Member since:
    Oct 2018

    Posted 13 Nov 2018 Link to this post

    I have several grids on a page that I have enabled the Telerik Busy Indicator using the RadAjaxManager. The busy indicator works fine on all of the grid except for one. I keep getting the error "Error: Unable to get property 'Cols' of undefined or null reference" only when I export to Excel or PDF. On the "btnRun" click the indicator displays like normal, but when I export I get the error. I did see another post in which this same error displayed but I've verified that I only have one instance of the AjaxManager.

     

        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdateInitiatorPanelsOnly="true" ClientEvents-OnRequestStart="requestStart" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="cmdLoad">
                    <UpdatedControls> 
                                 
                        <telerik:AjaxUpdatedControl ControlID="usrStatus" />
                        <telerik:AjaxUpdatedControl ControlID="grdScoreCard" />
                        <telerik:AjaxUpdatedControl ControlID="grdEHSMonthlyStats" />
                        <telerik:AjaxUpdatedControl ControlID="grdScoreCardTitles"/>
                        <telerik:AjaxUpdatedControl ControlID="grdScoreCardFormulaEntry"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnRun">
                    <UpdatedControls> 
                                 
                        <telerik:AjaxUpdatedControl ControlID="grdScoreCardDashboard"  />

                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

  2. Eyup
    Admin
    Eyup avatar
    3754 posts

    Posted 15 Nov 2018 Link to this post

    Hello Chuck,

    You should disable AJAX when exporting the grid content. This article explains and demonstrates how to do that:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Exporting/export-from-ajaxified-grid

    Also, you can check this resource:
    https://www.telerik.com/support/kb/aspnet-ajax/ajaxmanager/details/get-more-descriptive-errors-by-disabling-ajax

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Chuck
    Chuck avatar
    18 posts
    Member since:
    Oct 2018

    Posted 16 Nov 2018 in reply to Eyup Link to this post

    I've tried to use the following in the grdScoreCardDashboard.ItemCommand event for the Linkbutton clicked for the export but it didn't have an effect.

    Me.RadAjaxManager1.EnableAJAX = False.

    I'm using a <CommandItemTemplate> for the Export link buttons so not sure how I'd be able to use the "ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnExport)" option or the "btnExcelSinNumbers.Attributes.Add("onclick", String.Format("realPostBack('{0}', ''); return false;", btnExcelSinNumbers.UniqueID))" in the Page_Load event.

     

     

  4. Eyup
    Admin
    Eyup avatar
    3754 posts

    Posted 21 Nov 2018 Link to this post

    Hi Chuck,

    You can use the OnRequestStart event handler of either the RadAjaxManager or RadAjaxPanel to achieve this requirement. Let's say that the button in the CommandItemTemplate has the ID CustomExportButton. In this function you can check whether the target is this button and disable the ajax similar to the sample from the first article provided in my previous post.

    You can use indexOf, includes or endsWith methods to check for that.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top