does not seem to work in Visual Studio 2015, in C#, in Web Site project, on an ASCX User Control

Jul 5 at 11:27 AM
Edited Jul 5 at 11:31 AM
All,

FYI, this does not seem to work in Visual Studio 2015, in C#, in a Web Site project, on an ASCX User Control.

Per this link...

https://exporttoexcel.codeplex.com/discussions/68866#

...I did this...

In the toolbox right click on a tab and select "Choose Items".

Then click browse when the screen loads.

Find the dll and click open.

You will now see the control. Select it and press "Ok".

Drag and drop it on your page...viola!

...got this...

...

<%@ Register Assembly="ExportToExcel" Namespace="KrishLabs.Web.Controls" TagPrefix="RK" %>
...

    <RK:ExportToExcel ID="ExportToExcel1" runat="server" ApplyStyleInExcel="True" Charset="utf-8" ContentEncoding="windows-1250" EnableHyperLinks="True" ExportFileName="FileName.xls" IncludeTimeStamp="True" PageSize="All" Text="Export To Excel" GridViewID="GridViewForSummary" />
...and this was the error text in the IDE at run-time...

Unhandled exception at line 885, column 13 in http://localhost:57040/ScriptResource.axd?d=JnUc-DEDOM5KzzVKtsL1tQxoepjENiuVWmBRwOgr18txbsN3iJ1Zh_qbdjfB9DiDPruUq-CrgudwVuEeM46cbrtmtlVy68zn6w0T6unUnOqdiP7RSnehce-NEAHf1m1BNNeOfFd5NM_TLC-nngSjjZCF3zT1yyNe6wvFDRhgdQgX3N0yPekuPpHbUH1F1drp0&t=2a48f442
0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Value cannot be null.
Parameter name: key

...and here is where the run-time error points in the code break, it breaks with JavaScript runtime error in "ScriptResource.axd" as follows...

    function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
        if (this._request === executor.get_webRequest()) {
            this._processingRequest = false;
            this._additionalInput = null;
            this._request = null;
        }
        var handler = this._get_eventHandlerList().getHandler("endRequest");
        var errorHandled = false;
        if (handler) {
            var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
            handler(this, eventArgs);
            errorHandled = eventArgs.get_errorHandled();
        }
        if (error && !errorHandled) {
            throw error; // The error is here... 
        }
    }
...and so it does not seem to work in Visual Studio 2015, in C#, in a Web Site project, on an ASCX User Control.

Note that I cannot place the button on the hosting ASPX page, because my ASCX User Control is designed to run in DotNetNuke, and therefore all my custom code must be in the ASCX User Control itself, and I so do not have a good handle to the hosting ASPX page itself.

If you have a fix or workaround, then please let me know.

Thanks.

-- Mark Kamoski