2016-04-26 224 views
2

我在彈出窗口中有下面的代碼。我想,當用戶點擊導出按鈕來關閉這個彈出,按鈕點擊後關閉彈出框

Protected Sub btnExport_Click(sender As Object, e As EventArgs) Handles btnExport.Click 
    Try   
     Dim sw As New StringWriter() 
     Dim w As New HtmlTextWriter(sw) 
     gv.RenderControl(w) 

     Dim content As String = sw.GetStringBuilder().ToString() 

     'I have generate pdf code here 
     'I want to close this popup  
    Catch ex As Exception 

    End Try 
End Sub 
+0

你試過了'如果你的Button被按下'事件'然後卸載'你的彈出' –

+2

使用'Close()'將關閉表單。 – JerryM

回答

1

試試這個

ClientScript.RegisterStartupScript(GetType(), "winclose", "window.close();", true); 

它生成客戶端JavaScript渲染時將關閉當前窗口。

相關問題