I have a working Html.RouteLink that I want to convert to T4MVC.
The working RouteLink code is as follows:
<%= Html.RouteLink(vaultViewItem.NameDisplay,
new {controller = "Entity",
action= "Index",
dataType = vaultViewItem.VaultID},
new { target="vaultIFrame"}) %>
Converting the RouteLink directly does not work at all - the resultant URL contains the RouteValueDictionary class name, rather than the individual dictionary items.
I have tried to use the Html.ActionLink with T4MVC and the link will work fine, but the target is never picked up. (Valid link, but sent to _self rather than the stated 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?
Try this:
<%= Html.ActionLink(vaultViewItem.NameDisplay,
MVC.Entity.Index(vaultViewItem.VaultID),
new { target = "vaultIFrame" })%>
来源:https://stackoverflow.com/questions/4890138/t4mvc-html-actionlink-or-html-routelink-how-to-add-target