开发者

ASP Net - How to open up a form in a new window in ASP.NET

I am working on ASP.net using VB.net. I need to load a page in a new windo开发者_JAVA百科w on button click. Can someone suggest the code for the same.


If you do not need a postback to the new window, then this:

<input type="button" value="buttonName" onclick="window.open('[page]')" />

OR

<asp:button text="buttonName" onclientclick="window.open('[page]');return false;" />

Else you will have to set the 'target' attribute of the form to something e.g. "_blank"


You could try using this javascript within the Button.Attribute.Add method:

Button1.Attributes.Add("onclick", "window.open('mySite'); return false;");

You can remove the 'return false' if you want the button to continue its postback.

You can customise the javascript further. Parameter information can be found here: http://www.javascript-coder.com/window-popup/javascript-window-open.phtml


You should do that with javascript, for example using window.open().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜