Solved

FIle Upload VB.NET

Posted on 2011-03-09
6
925 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

635 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