.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 02, 2010    Points: 0   Category :ASP.Net

I am using an asynfileupload to save data to a database. After the data is saved into the database . I need to update an updatepanel .

<head runat="server">
    <script type ="text/javascript" >
        function UploadComplete(sender, args) {
        __doPostBack('UpdatePanel1', '');  

    <form id="form1" runat="server">  <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    <asp:UpdatePanel   ID="UpdatePanel1" UpdateMode ="Always"  runat="server">
    <ContentTemplate >
     <asp:Label ID="Label1" runat="server" Text ="1" Visib

View Complete Post

More Related Resource Links

how to refresh image updated with AsyncFileUpload


I've created an AsyncFileUpload device that uploads an image in ListView but it doesn't refresh on the page until the page is manually refreshed. Any ideas on how to accomplish this? This is the applicable code:

In ListView control:

<asp:UpdatePanel ID="udpPhoto" runat="server">
        <span style="text-align: center; vertical-align: middle; font-size: 7pt;">
            <br />
            <asp:Button ID="btnEPhoto" Font-Bold="False" TabIndex="160" Text="Upload/Change Photo"
                UseSubmitBehavior="False" OnClick="btnPhoto_Click" runat="server" />
            <br />
            <asp:Label ID="lblEPhoto" runat="server" Font-Bold="True" Text="Uploaded Photo:" />
            <br />
            <asp:HyperLink ID="lnkEPhoto" runat="server" BorderWidth="2px" NavigateUrl='<%# Eval("Photo_Recent") %>'
                <asp:Image runat="server" ImageUrl='<%# Eval("Photo_Recent") %>' Height="50px" ID="imgEPhoto">

AsyncFileUpload is not uploading the file



I have added AsyncFileUpload to creata user wizard control. When I tried to upload the file this control seemed to work fine and show confirmation at the end. But when I checked the website no file has been uploaded at all.

Here is the code, please let me know why its not uploading the files/images

<asp:ToolkitScriptManager ID="ScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"  
 FinishDestinationPageUrl="~/MyPage.aspx"                                     LoginCreatedUser="False" CreateUserButtonText="Add" oncreateduser="CreateUserWizard1_CreatedUser1" 
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" >
<asp:WizardStep ID="WizardStep1" runat="server" Title="Set preferences">
<asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" ThrobberID="spanUploading" OnClientUploadError="

Ajax Asyncfileupload doesn't work as soon as I put it in a control


Hi guys,

I can't get my <ajax:asyncfileupload> working and I don't see why...

When outside any panel or table it is working well, but as soon as I put it in a <asp:panel> or table I get a strange error which seems to be on client-side but I don't understand what's happen here. Here is the code and code-behind and Javascript.

Here's the error: 


Here's my front-code:

<%@ Page Language="VB" MasterPageFile="~/masterpages/mpSqueletton.master" AutoEventWireup="false" CodeFile="frmAdmGestSocietes.aspx.vb" Inherits="adm_frmAdmGestSocietes" title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server">
<script type="text/javascript" language="javascript">    
        function uploadError(sender,args)
          document.getElementById("<%= lblStatus.ClientID %>").innerText = args.get_fileName(), "<span style='color:red;'>" + args.get_errorMes

AsyncFileUpload: Throw Error on image size


I have an AsyncFilUpload that is used to upload  to my site. On the server side I have code that checks the width and height of the image and will only save the image if it is within the limits buit I can't figure out how to get the AsyncFileUpload control to show an error when this happens. Can anyone give me any pointers?


Asyncfileupload doesn't work in webusercontrol

I'm having a problem with a Webusercontrol that has an asyncfileupload control. My websusercontrol is being loaded in a placeholder control that's wrapped by an updatepanel.Due to asyncpostback, I have to load and clear the placeholder's controls. The webusercontrol works flawlessly, except the asyncfileupload, which doesn't want to upload at all. I can assure that the code is without error, because I used to have the webusercontrol running as an *.aspx site. I guess that the problem is the fact that the control has to be cleared and reloaded with every asyncpostback ?

Are ModalPopupExtender and AsyncFileUpload.OnClientUploadComplete incompatible?

A ModalPopupExtender works fine with a panel as the target control and the panel has an AsyncFileUpload control. However as soon as AsyncFileUpload.OnClientUploadComplete is set to something (e.g. onclientuploadcomplete="alert('hello');"),  the panel is not hidden on page load.Is there any compatibility issue here?


Dear Experts,Is it possible to include asncFileUpload in ajax 1.0 (visual Studio 2005), If yes can you please help me?thanks in advance

Cannot get Asyncfileupload to fire UploadComplete event... :(

hey everyone!I cannot get the asyncfileupload to fire the uploadcomplete event at all. I did a test:    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete         Dim currentUser As MembershipUser = Membership.GetUser()         Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)         errorLabel.Text = "Test"     End Sub    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete       errorLabel.Text = "Test"    End Suband... nothing. The background turns green, my throbber activates successfully.. but then, I get nothing. It doesnt even make it to the uploadedComplete event. I also did the same test in the error event.. and still nothing. Any ideas??

How to clear AsyncFileUpload if page revisited

Hello all,   just downloaded the latest Ajax toolkit and want to use AsyncFileUpload in my project. But the control keeps the path of previously uploaded file if page revisited again (in my case - a popup page). Is there any parameter can be set to clear the path box (it shows previous path in red). You know, the simple something like syncFileUpload.Clear() would of been nice! But it doesnt have it. Any work around? I tried to place it on page Init and set as New but didnt help.   Thanks in advance.   Nat    

user.identity.name="0" when uploading file using ajaxToolkit:AsyncFileUpload

hi, i am using AsyncFileupload to upload user picture. after the picture is uploaded and saved i opened another page and i noticed that the user.identity.name is lost. any idea 

RegularExpressionValidator and the new AsyncFileUpload

 Hi,I try to valide the new AJAX AsyncFileUpload control but it seems not to work : Control 'AsyncFileUpload1' referenced by the ControlToValidate property of 'REV1' cannot be validated.<cc1:AsyncFileUpload ID="AsyncFileUpload1" runat="server" Width="400px"                     ThrobberID="throbber" />                <asp:Label ID="throbber" Style="display: none" runat="server"><img alt="loading" src="images/upload.gif" /></asp:Label><asp:RegularExpressionValidator                    ID="REV1" runat="server" ErrorMessage=" File invalid"                    ControlToValidate="AsyncFileUpload1" ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[bB][mM][pP]|[pP][nN][gG])$)"                    Display="Dynamic" Text="

AsyncFileUpload inside FormView not working

I'm having a lot of problems with something seemingly simple, and from other posts sounds like people have been able to do. I have a FormView inside a user control, and in the InsertItemTemplate, I have an AsyncFileUpload control, that I would like to to use. On the user side, it seems to work, but it doesn't work on the server side code behind. The HasFile Property is always false, and it doesn't fire the UploadCompleted event either. My UpdatePanel is in the master page. Any ideas? Thanks <asp:FormView ID="frmAddImage" runat="server" DataKeyNames="imageID" DataSourceID="sqlImages" Width="100%"> <InsertItemTemplate> <cc1:AsyncFileUpload runat="server" ID="FileUploadImage" Width="400px" UploaderStyle="Traditional" CompleteBackColor="Lime" ErrorBackColor="Red" onuploadedcomplete="AsyncFileUpload_UploadedComplete" UploadingBackColor="#CCFFFF" />  

AsyncFileUpload- Uploading multiple files, individually.


Hi guys,

I've done some searching, but am unable to find what I'm after.

I'm using the asyncfileupload control, and have it woking to an extent. I'm able to upload the image to the relevant directory and save it's path to the database.

The problem I'm having is that I am unable to upload a 2nd file once the first has completed without refreshing the page.

Any ideas?

Thanks in advance!

AsyncFileUpload in version 40412 and RegisterStartupScript


Anyone know why RegisterStartupScript won't work in the UploadedComplete event?  It used to work just fine, but in version 40412, it doesn't do anything.

I had started another thread called 'AsyncFileUpload Broken??!!??', before I realised what was causing the problem.  Now that I have found the culprit, I thought a new thread is needed on this issue alone.

Any thoughts or suggestions would be appreciated

- David

AsyncFileUpload Broken?!?


Could someone tell me why the asyncfileupload doesn't work the way it used to, are these controls even tested?  The following used to work, but not any more.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="frm" runat="server">
    <asp:ToolkitScriptManager ID="tsm" runat="server" />
        <asp:AsyncFileUpload ID="afu" runat="server" OnUploadedComplete="afu_Up

AsyncFileUpload in VB.net How To tutorial

Imports System
Imports System.IO

Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports AjaxControlToolkit

Public Class UploadAFile
    Inherits System.Web.UI.Page
    'Event UploadedComplete()

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    End Sub

    Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete

        ScriptManager.RegisterClientScriptBlock(Me, Me.[GetType](), "size", "top.$get(""" + uploadResult.ClientID & """).innerHTML = 'Uploaded size: " & AsyncFileUpload1.FileBytes.Length.ToString() & "';", True)

        ' Uncomment to save to AsyncFileUpload\Uploads folder.
        ' ASP.NET must have the necessary permissions to write to the file system.

        Dim savePath As String = Server.MapPath(Path.GetFileName(AsyncFileUpload1.FileName))

    End Sub

    Sub AsyncFileUpload1_UploadedFileError(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedFileError
        ScriptManager.RegisterClientScriptBlock(Me, Me.[GetType](), "error", "t

Ajax AsyncFileUpload control not working in IE7.0 and IE8.0 browser in Integrated Windows Authentica



I am facing problem using Ajax AsyncFileUpload control in IE7.0 and IE8.0 browsers. 

It is working fine in local environment, when you deploy the code in Windows Server 2003 (IIS6.0) with Integrated Windows Authentication mode it is not working properly in IE7.0 and IE8.0 browsers. 


I am doing the validation in client side using OnClientUploadStarted, OnClientUploadComplete it is working fine but once click on any other button (server side) getting the error Internet Explorer cannot display the webpage (Diagnose Connection Problem) in IE7.0 and IE8.0 browser. Same thing is working fine in other browsers.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend