locked
AjaxFileUpload after OnUploadComplete event RRS feed

  • Question

  • User-1627226156 posted

    In ASP.NET (Web Forms) I set a value to a Label control on the page load event and can display the value with a Button control. After uploading a file using the AjaxFileUpload control the OnUploadComplete event fires and at that time I try reading the value from the Label control mentioned earlier yet no value is returned.

    Protected Sub AjaxFileUpload1_OnUploadComplete(ByVal sender As Object, ByVal e As AjaxFileUploadEventArgs)

    Any assistance would be greatly appreciated.

    Friday, August 14, 2020 6:20 PM

Answers

  • User-1519014291 posted

    Hi TimpthyV,

    You can set the label value in a session then use the session value inside the AjaxFileUpload1_OnUploadComplete event.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        session("lblvale") = Label1.text
    End Sub
    
    
    
    
    Protected Sub FileUploader_UploadComplete(sender As Object, e As AjaxFileUploadEventArgs) Handles FileUploader.UploadComplete
       
       'use this session("lblvale")
    
    
    End Sub

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 15, 2020 2:25 PM

All replies

  • User-1519014291 posted

    Hi TimpthyV,

    You can set the label value in a session then use the session value inside the AjaxFileUpload1_OnUploadComplete event.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        session("lblvale") = Label1.text
    End Sub
    
    
    
    
    Protected Sub FileUploader_UploadComplete(sender As Object, e As AjaxFileUploadEventArgs) Handles FileUploader.UploadComplete
       
       'use this session("lblvale")
    
    
    End Sub

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 15, 2020 2:25 PM
  • User-1627226156 posted

    Rebin.O.Q,

    Thank you for your accurate and quick answer, it is much appreciated. I tried that initially yet was not successful, not sure why.

    All the best!

    Saturday, August 15, 2020 5:59 PM
  • User-1519014291 posted

    Hi TimothyV,

    Are you still struggle with the problem?  please share  your code to us we will help to resolve that problem.

    Saturday, August 15, 2020 8:33 PM
  • User-1627226156 posted

    Rebin.O.Q,

    My apologies for forgetting to mention that your solution worked perfectly. How kind of you to check back with me. The solution is below:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
    Session("Label1Value") = Label1.Text
    End If
    End Sub

    Protected Sub AjaxFileUpload1_OnUploadComplete(ByVal sender As Object, ByVal e As AjaxFileUploadEventArgs)
    MsgBox(Session("Label1Value"))
    End Sub

    Again much appreciated and all the best!

    Saturday, August 15, 2020 10:04 PM