T4MVC Html.ActionLink or Html.RouteLink - how to add a target

I have a working Html.RouteLink that I want to convert to T4MVC.

The working code of RouteLink is as follows:

<%= Html.RouteLink(vaultViewItem.NameDisplay, 
                   new {controller = "Entity", 
                        action= "Index", 
                        dataType = vaultViewItem.VaultID}, 
                   new { target="vaultIFrame"}) %>

The RouteLink conversion does not work directly - the resulting URL contains the name of the RouteValueDictionary class, not individual dictionary entries.

I tried using Html.ActionLink with T4MVC and the link will work fine, but the target never goes up. (Valid link, but sent to itself, not to the specified target.)

<%= Html.ActionLink(vaultViewItem.NameDisplay,
                    MVC.Entity.Index(vaultViewItem.VaultID).AddRouteValues(
                                     new {target = "vaultIFrame"})) %>

How can I display the linked page in the desired iFrame?

+3
source share
1 answer

Try the following:

<%= Html.ActionLink(vaultViewItem.NameDisplay,
                    MVC.Entity.Index(vaultViewItem.VaultID),
                    new { target = "vaultIFrame" })%>        
+3
source

Source: https://habr.com/ru/post/1789821/


All Articles