本文介绍了T4MVC Html.ActionLink或Html.RouteLink-如何添加目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要转换为T4MVC的Html.RouteLink.

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

有效的RouteLink代码如下:

The working RouteLink code is as follows:

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

直接转换RouteLink根本不起作用-结果URL包含RouteValueDictionary类名,而不是各个字典项.

Converting the RouteLink directly does not work at all - the resultant URL contains the RouteValueDictionary class name, rather than the individual dictionary items.

我尝试将Html.ActionLink与T4MVC一起使用,并且该链接可以正常工作,但始终不会拾取目标. (有效链接,但发送给_self而不是指定的目标.)

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"})) %>

如何在所需的iFrame中显示链接的页面?

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

推荐答案

尝试一下:

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

这篇关于T4MVC Html.ActionLink或Html.RouteLink-如何添加目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 10:59