0

我目前正在将旧系统迁移到另一台服务器,当我测试应用程序时,我的弹出窗口显示一个空白页面。请参阅下面用于显示我的弹出消息的代码:

Private Sub ShowPopUp(ByVal myID As String, ByVal request As String, ByVal windowType As String, ByVal code As String)
    Dim popupScript As String = "<script language='javascript'>" & _
                                    "window.open('NewWindow.aspx?windowType=" & windowType & "&id=" & myID & _
                                    "&code=" & code & "&popup=" & request & "&kind=3', 'CustomPopUp', " & _
                                    "'width=700, height=400, menubar=no, resizable=yes')" & _
                                "</script>"

    Page.RegisterStartupScript("PopupScript", popupScript)
End Sub

现在,这曾经在旧站点和本地站点上完美运行。但是,一旦转移到新服务器,我就会不断收到警告,Page.RegisterStartupScript is obsolete并且应该将其更改为Page.ClientScript.RegisterStartupScript. 所以我做了更改,请参见下文:

Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopupScript", popupScript, True)

但是,这些都不起作用。它在我的弹出窗口上显示一个空白页面,这与使用“旧”方式在我的本地运行应用程序的结果相反,它显示了我想要的输出。

4

1 回答 1

1

您的代码应该是理想的

Private Sub ShowPopUp(ByVal myID As String, ByVal request As String, ByVal windowType As String, ByVal code As String)
    Dim popupScript As String = String.Format("window.open('\NewWindow.aspx?windowType={0}&id={1}&code={2}&popup={3}&kind=3', '{4}', '{5}')",
            windowType, 
            myID, 
            code, 
            request,
            "CustomPopUp",
            "width=700, height=400, menubar=no, resizable=yes" )

    ClientScript.RegisterStartupScript("PopupScript", popupScript, True)
End Sub
于 2012-10-22T08:34:54.230 回答