I have a label in my update panel that I want to update its text on after a successful asynchronus file upload. Here's my markup:
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
Step 1 (<asp:Label ID="label_fileupload" runat="server" />):
<br />
<ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" Width="200px" runat="server"
CompleteBackColor="Lime" UploaderStyle="Modern" ErrorBackColor="Red" ThrobberID="Throbber"
UploadingBackColor="#66CCFF" OnClientUploadStarted="StartUpload" />
<asp:Label ID="Throbber" runat="server" Style="display: none"><img src="/images/indicator.gif" alt="loading" /></asp:Label>
<br />
<asp:Label ID="statuslabel" runat="server" Text="Label"></asp:Label>
</ContentTemplate></asp:UpdatePanel>
Here is my code-behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (IsPostBack) Then
Else
label_fileupload.Text = "Incomplete"
label_fileupload.CssClass = "uploadincomplete"
statuslabel.Text = "NOT DONE"
End If
End Sub
Public Sub AsyncFileUpload1_UploadedComplete1(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete
System.Threading.Thread.Sleep(1000)
If (AsyncFileUpload1.HasFile) Then
Dim strPath As String = MapPath("/images/White.png")
AsyncFileUpload1.SaveAs(strPath)
End If
label_fileupload.Text = "Complete"
label_fileupload.CssClass = "uploadcomplete"
statuslabel.Text = "DONE"
End Sub
When I set the labels to update via a button click, they work. But when I set them to update via the Upload complete event, they don't work.
Is there some way around this to get the labels to update their text / css class from the UploadedComplete event of an asynchronous file upload control?