請看看下面的click事件...強制回發Asp.Net
Protected Sub btnDownloadEmpl_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDownloadEmpl.Click Dim emplTable As DataTable = SiteAccess.DownloadEmployee_H() Dim d As String = Format(Date.Now, "d") Dim ad() As String = d.Split("/") Dim fd As String = ad(0) & ad(1) Dim fn As String = "E_" & fd & ".csv" Response.ContentType = "text/csv" Response.AddHeader("Content-Disposition", "attachment; filename=" & fn) CreateCSVFile(emplTable, Response.Output) Response.Flush() Response.End() lblEmpl.Visible = True End Sub
此代碼簡單地從數據表中導出數據到CSV文件。這裏的問題是lblEmpl.Visible = true永遠不會被擊中,因爲這段代碼不會導致回發到服務器。即使我將代碼行lblEmpl.Visible = true置於點擊事件的頂部,該行仍可正常執行,但頁面不會更新。我怎樣才能解決這個問題?
您正在運行到同一個問題,因爲這個帖子:http://stackoverflow.com/questions/2731971/problem-clearing-text-fields-on-vb-net-project-vs2008/2732657#2732657 – 2010-05-12 17:13:19