I have the following code in a downloadable AsyncFileUpload event handler:
Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete Dim oapp As Excel.Application Dim oWBa As Excel.Workbook Dim oWS As Excel.Worksheet Dim oRng As Excel.Range oapp = New Excel.Application AsyncFileUpload1.PostedFile.SaveAs(Server.MapPath("tempfile2.xlsx")) oWBa = oapp.Workbooks.Open(Server.MapPath("tempfile2.xlsx")) oWS = DirectCast(oWBa.Worksheets(2), Excel.Worksheet) 'Here tns is a textbox contained in a panel tns.Text = Integer.Parse(oWS.Range("W44").Value) + Integer.Parse(oWS.Range("W55").Value) oWBa.Close() File.Delete(Server.MapPath("tempfile2.xlsx")) End Sub
The autostostback tns property is enabled, so why doesn't it change its text when a file is uploaded? Also, there is no error in the reading logic of the excel file, because I debugged it using VS 2010 and Uptil in the tns.text ... line, I get the correct value in watch.So, how can I get around it?
source share