DevExpress / AjaxControlToolkit

The ASP.NET AJAX Control Toolkit is a classic set of ASP.NET WebForms extensions.
https://devexpress.com/act
BSD 3-Clause "New" or "Revised" License
289 stars 136 forks source link

Javascript error in AjaxFileUpload.js #88

Closed R-McN closed 8 years ago

R-McN commented 8 years ago

Hello, I'm successfully using the AjaxFileUpload control in VS 2013 but, as I want to check file sizes BEFORE uploading, I'm trying out some javascript code that uses AjaxFileUpload.js. I get the following error every time the page loads. I've seen that MikhailTymchukDX has been making some changes regarding the AjaxFileUpload control and I'm wondering if the changes will help with this issue - if so, is there a set of updated files I could download?

Unhandled exception at line 1, column 1 in http://localhost:54093/js/AjaxFileUpload.js

0x800a1391 - JavaScript runtime error: 'Type' is undefined

MikhailTymchukDX commented 8 years ago

This feature is implemented in PR #73 You can download the entire repository or the latest version of the AjaxFileUpload.js file.

As for the error you provided, would you please describe it in more detail:

  1. What application do you run?
  2. If possible, make a screenshot of the browser console with this error. I am looking forward to your response.
R-McN commented 8 years ago

Hello Mikhail,

Thanks for your support. I’ve recently been employed by a company that has a web application called ‘SafeWells’. It’s a pretty big project, but it is quite old and in need of some modernization – so I’m currently trying to improve its file uploading feature. The problem happens when I load a page with which is called by some javascript on the page:

There is a scriptmanager…

/asp:ScriptManager And the ajax upload control is: The error occurs during the page load and the VS debugger opens AjaxFileUpload.js, highlights Type.registerNamespace("Sys.Extended.UI.AjaxFileUpload");, and shows: [cid:image002.png@01D1A625.680F9EF0] Here is the browser console you referred to… [cid:image001.png@01D1A622.598FA4E0] Thanks again for your help. Regards, Richard From: MikhailTymchukDX [mailto:notifications@github.com] Sent: 04 May 2016 13:36 To: DevExpress/AjaxControlToolkit Cc: Richard McNaught; Author Subject: Re: [DevExpress/AjaxControlToolkit] Javascript error in AjaxFileUpload.js (#88) This feature is implemented in PR #73https://github.com/DevExpress/AjaxControlToolkit/pull/73 You can download the entire repository or the latest version of the AjaxFileUpload.jshttps://github.com/DevExpress/AjaxControlToolkit/blob/master/AjaxControlToolkit/Scripts/AjaxFileUpload.js file. As for the error you provided, would you please describe it in more detail: 1. What application do you run? 2. If possible, make a screenshot of the browser console with this error. I am looking forward to your response. — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/DevExpress/AjaxControlToolkit/issues/88#issuecomment-216848288 Important Notice: The information in this email is confidential and may be legally privileged. If you have reason to believe you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful and you are requested to contact the sender urgently and dispose of this e-mail. We make every effort to keep our network free from viruses. You should, however, check this e-mail, and any attachments to it, for viruses, as we will not be liable for direct, special, indirect or consequential damages as a result of any virus being passed on, or arising from alteration of the contents of this message by a third party. Company registration details, including registered office information, for Expro's principal UK companies can be found via the following link: www.exprogroup.com/about-us/locations/#Europe_CIS
MikhailTymchukDX commented 8 years ago

@R-McN  I cannot see the screenshots you attached. Would you please re-attach them using the GitHub browser UI?

R-McN commented 8 years ago

rmn1 rmn2

MikhailTymchukDX commented 8 years ago

Is js/AjaxFileUpload.js a custom script file or a file from the AJAX Control Toolkit scripts?

R-McN commented 8 years ago

It is one of the AjaxControlToolkit files that I got from the sample site (that was installed with the toolkit) and it is in a folder called ‘js’ off the root of my web site.

From: MikhailTymchukDX [mailto:notifications@github.com] Sent: 05 May 2016 09:23 To: DevExpress/AjaxControlToolkit Cc: Richard McNaught; Mention Subject: Re: [DevExpress/AjaxControlToolkit] Javascript error in AjaxFileUpload.js (#88)

Is js/AjaxFileUpload.js a custom script file or a file from the AJAX Control Toolkit scripts?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/DevExpress/AjaxControlToolkit/issues/88#issuecomment-217101825

Important Notice: The information in this email is confidential and may be legally privileged. If you have reason to believe you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful and you are requested to contact the sender urgently and dispose of this e-mail. We make every effort to keep our network free from viruses. You should, however, check this e-mail, and any attachments to it, for viruses, as we will not be liable for direct, special, indirect or consequential damages as a result of any virus being passed on, or arising from alteration of the contents of this message by a third party. Company registration details, including registered office information, for Expro's principal UK companies can be found via the following link: www.exprogroup.com/about-us/locations/#Europe_CIS

MikhailTymchukDX commented 8 years ago

Why do you place it there? AjaxFileUpload will work without it by default, but if you need physical files to be downloaded, you have to install the AjaxControlToolkit.StaticResources NuGet package and disable bundling.

R-McN commented 8 years ago

I added it because I thought that it was required for being able to validate files before they are uploaded to the server and then to remove them from the queue if they are invalid. Am I mistaken?

From: MikhailTymchukDX [mailto:notifications@github.com] Sent: 05 May 2016 09:45 To: DevExpress/AjaxControlToolkit Cc: Richard McNaught; Mention Subject: Re: [DevExpress/AjaxControlToolkit] Javascript error in AjaxFileUpload.js (#88)

Why do you place it there? AjaxFileUpload will work without it by default, but if you need physical files to be downloaded, you have to install the AjaxControlToolkit.StaticResourceshttps://www.nuget.org/packages/AjaxControlToolkit.StaticResources/ NuGet package and disable bundlinghttps://github.com/DevExpress/AjaxControlToolkit/wiki/How-to-use-bundling-and-CDN#to-disable-bundling.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/DevExpress/AjaxControlToolkit/issues/88#issuecomment-217104710

Important Notice: The information in this email is confidential and may be legally privileged. If you have reason to believe you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful and you are requested to contact the sender urgently and dispose of this e-mail. We make every effort to keep our network free from viruses. You should, however, check this e-mail, and any attachments to it, for viruses, as we will not be liable for direct, special, indirect or consequential damages as a result of any virus being passed on, or arising from alteration of the contents of this message by a third party. Company registration details, including registered office information, for Expro's principal UK companies can be found via the following link: www.exprogroup.com/about-us/locations/#Europe_CIS

MikhailTymchukDX commented 8 years ago

AjaxFileUpload has no capability to validate files before uploading except for the file extension (as for the v16.1 release). The code that performs that validation is the code you provided earlier and it has no relevance to the AJAX Control Toolkit code.

AjaxFileUpload.js file and all dependencies are loaded automatically in correct order by the toolkit, so you need no extra actions. Trying to load it explicitly can cause errors, because it uses types defined in files that are not loaded yet.

 You can inspect Network tab in a browser's developer tools to get familiar with scripts' load sequence.

R-McN commented 8 years ago

OK, I’ll remove the js file. Thanks for your help Mikhail. Best regards, Richard

From: MikhailTymchukDX [mailto:notifications@github.com] Sent: 05 May 2016 10:15 To: DevExpress/AjaxControlToolkit Cc: Richard McNaught; Mention Subject: Re: [DevExpress/AjaxControlToolkit] Javascript error in AjaxFileUpload.js (#88)

AjaxFileUpload has no capability to validate files before uploading except for the file extension (as for the v16.1 release). The code that performs that validation is the code you provided earlier and it has no relevance to the AJAX Control Toolkit code.

AjaxFileUpload.js file and all dependencies are loaded automatically in correct order by the toolkit, so you need no extra actions. Trying to load it explicitly can cause errors, because it uses types defined in files that are not loaded yet.

You can inspect Network tab in a browser's developer tools to get familiar with scripts' load sequence.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/DevExpress/AjaxControlToolkit/issues/88#issuecomment-217109366

Important Notice: The information in this email is confidential and may be legally privileged. If you have reason to believe you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful and you are requested to contact the sender urgently and dispose of this e-mail. We make every effort to keep our network free from viruses. You should, however, check this e-mail, and any attachments to it, for viruses, as we will not be liable for direct, special, indirect or consequential damages as a result of any virus being passed on, or arising from alteration of the contents of this message by a third party. Company registration details, including registered office information, for Expro's principal UK companies can be found via the following link: www.exprogroup.com/about-us/locations/#Europe_CIS