У меня есть 2 кнопки управления.Один предназначен для загрузки в формате Excel, а другой - для кнопки ссылки, открывающей новую вкладку для другой страницы.При первом нажатии кнопка загрузки работает нормально.Это в состоянии загрузить файл Excel.Но после того, как я нажму на ссылку, которая перенаправит на другую страницу.Я снова нажимаю кнопку загрузки, и она не работает, и файл Excel не загружается.
VB Net Code:
Protected Sub btnExcel_AllService_OnClick(ByVal sender As Object, ByVal e As System.EventArgs)
CType(sender, Control).Parent.Visible = False
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=AllServiceEndOfDay.xls")
Response.Charset = ""
EnableViewState = False
Dim stringWriter As New System.IO.StringWriter()
Dim htmlWriter As New HtmlTextWriter(stringWriter)
isCustomRendering = True
divExport.RenderControl(htmlWriter)
Dim style = "<style> td { mso-number-format:\@; } </style> "
Response.Write(style)
Response.Write(stringWriter)
Response.End()
isCustomRendering = False
EnableViewState = True
End Sub
Protected Sub LinkButton_Telco(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButtonTelco.Click
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "key", "window.open('index.aspx');", True)
End Sub