简体   繁体   中英

Click on button to pop-up new window with passing URL in .net c# web application

I'm new in .net C#, just a question here. how can I click a button then it will pop-up a new window to display a page?

example: If I have a page test.aspx, how can I code in .net c# web application so that it will pop-up a new window to display this page?

There's nothing intrinsic with ASP.NET or C# that does this. You're still outputting Html, so the methods of doing such a thing in JavaScript or target="_blank" in a link will still work.

You can call window.open("test.aspx"); in Javascript.

If you want a nice looking solution, you can use a JavaScript implemenation called ColorBox http://colorpowered.com/colorbox/

You would render that second page as an Iframe inside a dialog / popup. See this example page http://colorpowered.com/colorbox/core/example5/index.html : Other Content Types -> Outside Webpage (Iframe)

ASP.NET HyperLink Control is another way. You have access to it's properties on code-behind if you need to manipulate the Url programmatically.

如果使用“打开新窗口”,它将在新窗口中打开。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM