Html popup window from code behind file

流过昼夜 提交于 2019-11-29 18:13:16

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("<script>window.open('{0}');</script>", 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 = "<html><body><div style=""color:black"">Name: Jame's</div></body></html>"
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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!