In this article I will explain with an example, how to open Page (View) in New Tab (Window) on Button Click in ASP.Net Core (.Net Core 8) MVC.
Button cannot be used to open Page (View) in New Tab (Window) and hence using JavaScript’s window.open function, the Page (View) will be opened in New Tab (Window) on Button Click in ASP.Net Core (.Net Core 8) MVC.
Note: For beginners in ASP.Net Core (.Net Core 8) MVC, please refer my article ASP.Net Core 8: Hello World Tutorial with Sample Program example.
 
 

Controller

The Controller consists of following Action methods.

Action method for handling GET operation for Index

Inside this Action method, simply the View is returned.
 

Action method for handling GET operation for About

Inside this Action method, simply the View is returned.
public class HomeController : Controller
{
    // GET: Home
    public IActionResult Index()
    {
        return View();
    }
 
    public IActionResult About()
    {
        return View();
    }
}
 
 

View

HTML Markup

The View consists of an HTML Button assigned with an OnClick event handler.
When the Button is clicked, the About View is opened in New Tab (Window) using window.open function of JavaScript.
@{
     Layout = null;
}
 
<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <input type="button" value="Open" onclick="window.open('@Url.Action("About", "Home")')" />
</body>
</html>
 
 

Screenshot

ASP.Net Core: Open Page (View) in New Tab (Window) on Button Click
 
 

Browser Compatibility

The above code has been tested in the following browsers.
Microsoft Edge   FireFox  Chrome  Safari  Opera
* All browser logos displayed above are property of their respective owners.
 
 

Downloads