Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Ajax VB.NET
How can I use the AsyncFileUpload control from ajaxtoolkit in vb.net?
Posted 10-Aug-12 0:34am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I am just writing an example...you can alter it according to your requirement.
 
the script will be like this
 
<script type = "text/javascript" >
 
function getFileAs()
{
document.getElementById ("<%=txtFileAs.ClientId%>").value = document.getElementById ("<%=txtEmployeeName.ClientId%>").value
}
</script>
<script type = "text/javascript">
        function uploadComplete(sender) {
            $get("<%=lblStatus.ClientID%>").innerHTML = "File Uploaded Successfully";
        }
        function uploadError(sender) {
            $get("<%=lblStatus.ClientID%>").innerHTML = "File upload failed.";
        }
</script>
 
The asp control
 
<asp:AsyncFileUpload ID="AsyncFileUpload1"  OnClientUploadError="uploadError" OnClientUploadComplete="uploadComplete"
        runat="server"  UploaderStyle="Modern" CompleteBackColor="White"
        UploadingBackColor="#CCFFFF" ThrobberID="imgLoader" 
                OnUploadedComplete="AsyncFileUpload1_UploadedComplete" 
                FailedValidation="False" />
    <asp:Image ID="imgLoader" runat="server" ImageUrl="~/Images/indicator.gif" />
    <asp:Label ID="Throbber" runat="server" Style="display: none">
            <img src="~/Images/indicator.gif" align="absmiddle" alt="loading" />
        </asp:Label>
            <asp:Label ID="lblStatus" runat="server" 
                Style="font-family: Arial; font-size: small;"></asp:Label>
 

The VB Code
 
Public Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs)
        System.Threading.Thread.Sleep(5000)
        If AsyncFileUpload1.HasFile Then
 
            Session("link") = Path.GetFileName(e.FileName)
            Dim strPath As String = MapPath("~/Uploads/") + Path.GetFileName(e.FileName)
            AsyncFileUpload1.SaveAs(strPath)
        End If
    End Sub
  Permalink  
v3
Comments
caspi.rulez at 10-Aug-12 6:51am
   
nice ans...thanx :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 10 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100