Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have a a razor action link open in a new tab?

Tags:

html

c#

razor

I trying to get my link to open in a new tab (it must be in razor format):

    <a href="@Url.Action("RunReport", "Performance", new { reportView = Model.ReportView.ToString() }, new { target = "_blank" })" type="submit" id="runReport" class="button Secondary">@Reports.RunReport</a> 

This is not working though. Anyone know how to do this?

like image 404
FairyQueen Avatar asked Jun 01 '12 14:06

FairyQueen


People also ask

How to open Action link in new tab?

Just put in the <a> tag itself.


1 Answers

Just use the HtmlHelper ActionLink and set the RouteValues and HtmlAttributes accordingly.

@Html.ActionLink(Reports.RunReport, "RunReport", new { controller = "Performance", reportView = Model.ReportView.ToString() }, new { target = "_blank" }) 
like image 81
Gabe Avatar answered Oct 06 '22 01:10

Gabe