Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FIle Upload VB.NET

Posted on 2011-03-09
6
Medium Priority
?
927 Views
Last Modified: 2013-11-08
I am trying to use the Ajax AsyncFileUpload.  Once I select the file I get the following error.

Microsoft JScript runtime error: 'lblStatus' is undefined.
Here is my html

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ MasterType virtualpath="~/MasterPages/Speaker.master" %>

the control

<asp:UpdatePanel ID="pnlUpload" runat="server">
		<ContentTemplate>
			<table>
				<cc1:AsyncFileUpload ID="fuSlides" Width="400px" runat="server"
				OnClientUploadError="uploadError" 
				OnClientUploadStarted="StartUpload" 
				OnClientUploadComplete="UploadComplete" 
				CompleteBackColor="Lime"
				UploaderStyle="Modern" 
				ErrorBackColor="Red" 
				onuploadedcomplete="fuSlides_UploadedComplete" 
				UploadingBackColor="#66CCFF" />
			</table>
			<br>
			</br>
			<asp:Label ID="lblStatus" runat="server" Text="Label"></asp:Label>
		</ContentTemplate>	
	</asp:UpdatePanel>

the javascript

 <script type="text/javascript" language="javascript">
	     function uploadError(sender, args) {
	         alert("[" + lblStatus + "]"); return false;
	         document.getElementById('lblStatus').innerHTML = args.get_errorMessage();
		 }
	     function StartUpload(sender, args) {
	         alert("[" + fuSlides + "]"); return false;
			 var filename = args.get_fileName();
			 var filext = filename.substring(filename.lastIndexOf(".") + 1);
			 if (filext == "doc" || filext == "docx" || filext == "pdf" || filext == "pages" || filext == "pptx" || filext == "ppt") {
				 return true;
			 }
			 else {
				 var err = new Error();
				 err.name = 'My API Input Error';
				 err.message = 'Only .ppt, .pptx, .doc, .docx, or .pdf  files';
				 throw (err);

				 return false;
			 }
		 }
	    function UploadComplete(sender, args) {;
			var filename = args.get_fileName();
			var contentType = args.get_contentType();
			var text = "Size of " + filename + " is " + args.get_length() + " bytes";
			if (contentType.length > 0) {
				text += " and content type is '" + contentType + "'.";
			}
		}
</script>

Open in new window

0
Comment
Question by:triplebd69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35086750
Instead of:
document.getElementById('lblStatus').innerHTML = args.get_errorMessage();

Open in new window

Try:
document.getElementById('<%= lblStatus.ClientID %>').innerHTML = args.get_errorMessage();

Open in new window

0
 

Author Comment

by:triplebd69
ID: 35086920
Thanks for the comment.  That helped some.

As soon as I press open on the browse window, to open a file I get -
 "Unknown server error"

When I click ok I get
"Error: ASP.NET Ajax client-side framework failed to load."

Then
"Sys unknown"
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35087047
What does "fuSlides_UploadedComplete" do?
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:triplebd69
ID: 35087230
Right now not much, I have a break point set on it and it never hits it.

 Protected Sub fuSlides_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles fuSlides.UploadedComplete

        If e.state = AjaxControlToolkit.AsyncFileUploadState.Success Then
            lblStatus.Text = "Uploaded"
        End If

    End Sub
0
 

Accepted Solution

by:
triplebd69 earned 0 total points
ID: 35087391
Turns out that this site is running on 2.0 framework, so I don't think that I can get this control to work on it, I believe that it needs the 3.5 framework or higher.
0
 

Author Closing Comment

by:triplebd69
ID: 35135916
Wrong framework
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question