0

有以下问题:

我有一个导致 __doPostBack(button.ClientID,'texthere') 的 HTML 按钮。

Dim button As HtmlButton
button = CType(Me.btnButton, HtmlButton)
button.Attributes.Add("onclick", "__doPostBack('" & btnButton.ClientID & "', 'btnBBHistory');return false;")

在我的 page_load 中,我有以下内容:

Dim control_postback = Request("__EVENTARGUMENT")
    If control_postback = "texthere"
            Page.ClientScript.RegisterStartupScript(Me.GetType(), "Script", "ShowWindow();", 
    End If

显示窗口();javascript 函数使用 showModalDialog 显示。

  Dim s As New StringBuilder
        s.Append("<script type=""text/javaScript"">")
        s.Append("function ShowWindow() {" & ControlChars.CrLf)
        '  s.Append("var result = window.showModalDialog('" & url & "','','dialogWidth:1200px;dialogHeight:450px;resizable:yes');" & ControlChars.CrLf)
        s.Append("var result = window.showModalDialog('" & url & "','','dialogWidth:1100px;dialogHeight:500px;resizable:yes;help:no;');" & ControlChars.CrLf)
        s.Append("if (result) { " & ControlChars.CrLf)
        ' s.Append("document.getElementById('" & lblwhatever.ClientID & "').innerHTML=result.fullline;" & ControlChars.CrLf)
        s.Append("if (result.text.length || result.quantity.length) { " & ControlChars.CrLf)
        s.Append("document.getElementById('" & txtwhatever.ClientID & "').value=result.text.concat(result.quantity);" & ControlChars.CrLf)
        s.Append("document.getElementById('" & txtqty.ClientID & "').value=result.quantity;" & ControlChars.CrLf)

        s.Append("__doPostBack()" & ControlChars.CrLf)
        s.Append("}" & ControlChars.CrLf)
        s.Append("}" & ControlChars.CrLf)
        s.Append("return false;" & ControlChars.CrLf)
        s.Append("}" & ControlChars.CrLf)
        s.Append("</script>")
        If Not ClientScript.IsClientScriptBlockRegistered("ShowWindow") Then
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "ShowWindow", s.ToString())
        End If

这一切正常,并显示带有生成的 URL 的对话框。但是,在原始网页(最初单击按钮以生成此对话框的网页)上,有一个图像(.djvu 格式)。每当我的代码运行时,由于 __doPostBack() 会刷新原始页面,但在某些版本的 IE(到目前为止为 IE8 和 9)中,图像不会重新加载。showModalDialog 是否有可能阻止在这些版本的 IE 上在后台进一步呈现页面,或者 doPostBack() 实际上并没有以某种方式进行完整的回发并且图像正在破坏?

感谢您提供的任何帮助

4

1 回答 1

0

修复:我需要使用 window.open 而不是 showmodaldialog,因为使用 showmodaldialog 时,父/调用页面(我相信)暂停/停止/中断父页面的执行,直到子页面关闭

于 2014-09-23T15:02:46.363 回答