简体   繁体   English

Html.TreeView中的Html.ActionLink?

[英]Html.ActionLink in Html.TreeView?

Hi, 你好

Im using the HTML.TreeView to render my code structure like this : 我正在使用HTML.TreeView来呈现我的代码结构,如下所示:

            <%= Html.TreeView("CategoryTree",
            Model.CategoryList,
            l => l.ChildList,
            l => l.Name + "&nbsp;/&nbsp;<a id=\"treeLnk" + l.Id + "\" href=\"JavaScript: OpenAddDialog('" + l.Name + "', " + l.Id + ") \" title=\"Lägg till\" >Lägg till</a>" +
                          "&nbsp;/&nbsp;<a id=\"treeLnk" + l.Id + "\" href=\"JavaScript: OpenChangeNameDialog('" + l.Name + "', " + l.Id + ") \" title=\"Ändra namn\" >Ändra namn</a>" +
                          "&nbsp;/&nbsp;<a id=\"treeLnk" + l.Id + "\" href=\"JavaScript: OpenDeleteDialog('" + l.Name + "', " + l.Id + ") \" title=\"Tabort\" >Tabort</a>") %>

This work fine, but now I need to include a action that redirects to another controller\\action. 这项工作正常,但是现在我需要包含一个重定向到另一个controller \\ action的操作。

I have tried to ad a Html.ActionLink but this does not work? 我尝试投放Html.ActionLink,但这不起作用吗?

You could have specified which TreeView helper are you using because there's no such thing built-in ASP.NET MVC but try like this: 您可能已经指定了要使用的TreeView助手,因为没有内置的ASP.NET MVC这样的东西,但请尝试如下操作:

<%= Html.TreeView("CategoryTree",
    Model.CategoryList,
    l => l.ChildList,
    l => l.Name + Html.ActionLink("Link Text", "action", "controller").ToHtmlString()) 
%>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM