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

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

3 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chuck
Top achievements
Rank 1
Veteran
Chuck asked on 13 Nov 2018, 04:44 PM

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>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 16 Nov 2018, 05:50 AM
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.
0
Chuck
Top achievements
Rank 1
Veteran
answered on 16 Nov 2018, 04:12 PM

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.

 

 

0
Eyup
Telerik team
answered on 21 Nov 2018, 11:19 AM
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.
Tags
Grid
Asked by
Chuck
Top achievements
Rank 1
Veteran
Answers by
Eyup
Telerik team
Chuck
Top achievements
Rank 1
Veteran
Share this question
or