Html popup window from code behind file

前端 未结 1 431
陌清茗
陌清茗 2020-12-22 08:07

This could be a simple but I havent found any easy solution.

On clicking button in asp.net web page on button click event html is generated from xml and xsl. This ht

1条回答
  •  一整个雨季
    2020-12-22 08:37

    You can only create a popup-window with javascript, so you need to register that script from codebehind:

    ClientScript.RegisterStartupScript(Me.GetType(), "newWindow", String.Format("", url))
    

    Maybe i've misunderstood your requirement. You want not only to open a client-side popup(window.open) from codebehind but also create that window on the fly without url?

    Maybe this helps(untested):

    Dim popupHtml = "
    Name: Jame's
    " Dim openPopupScript = "NewPopup=window.open("", 'newWindow', 'height=250, width=250');" & _ "NewPopup.document.open();" & _ String.Format("NewPopup.document.write('{0}');", popupHtml) & _ "NewPopup.document.close();" ClientScript.RegisterStartupScript(Me.GetType(), _ "newWindow", _ openPopupScript)

    0 讨论(0)
提交回复
热议问题