Hi rakeshkuma,
If you want to display any information using OnUploadedComplete from server side, its not possible.
One work around is that you use ScriptManager RegisterClientScriptBlock().
Refer below code.
HTML
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajax:AsyncFileUpload ID="AsyncFileUpload1" CssClass="form-control" CompleteBackColor="White"
Width="100%" runat="server" UploaderStyle="Modern" UploadingBackColor="White" ThrobberID="imgLoad"
OnUploadedComplete="AsyncFileUpload1_UploadedComplete" />
<asp:Image ID="imgLoad" runat="server" ImageUrl="~/images/loader.gif" />
<asp:Label ID="Label38" runat="server" Font-Size="12px" ForeColor="Green"></asp:Label>
<asp:Label ID="Label39" runat="server" Font-Size="12px" ForeColor="Red"></asp:Label>
Code
C#
protected void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
{
string extension = Path.GetExtension(e.filename);
if (extension.ToLower() == ".pdf")
{
AsyncFileUpload1.SaveAs(Server.MapPath("documents/") + Path.GetFileName(e.filename));
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success",
"top.$get(\"" + Label38.ClientID + "\").innerHTML ='Upload done !!';", true);
}
else
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "error",
"top.$get('" + Label39.ClientID + "').innerHTML ='Upload only .pdf file !!';", true);
}
}
VB.Net
Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs)
Dim extension As String = Path.GetExtension(e.filename)
If extension.ToLower() = ".pdf" Then
AsyncFileUpload1.SaveAs(Server.MapPath("documents/") + Path.GetFileName(e.filename))
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "success", _
"top.$get(""" & Label38.ClientID & """).innerHTML ='Upload done !!';", True)
Else
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "error", _
"top.$get('" & Label39.ClientID & "').innerHTML ='Upload only .pdf file !!';", True)
End If
End Sub