【问题标题】:How to go to another view by clicking the label如何通过单击标签转到另一个视图
【发布时间】:2013-11-19 20:58:17
【问题描述】:

我正在使用带有 MVC 架构的 asp.net。我正在设计一个以表格格式显示用户详细信息的网页。我想单击标签并选择整行并更新详细信息。即点击我想去另一个视图的标签。我怎么能这样做?

<th> @Html.Label("UserName")&nbsp;&nbsp;
<th> @Html.Label("Email") &nbsp;&nbsp;</th>
<th>  @Html.Label("CreatedBy")</th>
</tr>

@foreach(模型中的变量项) { @Html.Encode(item.UserName) @Html.Encode(item.Email) @Html.Encode(item.CreatedBy) }

【问题讨论】:

  • 你有没有尝试过?显示您的代码。

标签: asp.net-mvc-4


【解决方案1】:

您的问题非常广泛,但我认为如果您想要拥有也像超链接一样的标签,这就是您所需要的。

Html.ActionLink(item.UserName,        // Text shown  
                "YourController",     // Controller Name
                "YourAction",         // Action Method Name
                new { id = item.id }, // Route arguments.
                null)                 // HTML Arguments, ccs class, html Id, etc.

更多信息可以去here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-19
    • 1970-01-01
    • 1970-01-01
    • 2019-10-26
    相关资源
    最近更新 更多