I have the following code in AsyncFileUpload's upload complete 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 autopostback property of tns is turned on so why does it not change its text when a file is uploaded? Also there is no question of error in logic of reading the excel file because I have debugged it using VS 2010 and Uptil the line tns.text..., I get the correct value in the watch.So how shall I get round it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…