【问题标题】:How to get the dynamic values in shared view pages?如何获取共享视图页面中的动态值?
【发布时间】:2014-08-26 08:23:41
【问题描述】:
@Html.ActionLink("Edit Profile", "Index", "Profile")

我想要用户的用户名而不是“编辑个人资料”文本。此操作链接位于用户的共享页面中。

【问题讨论】:

    标签: c# asp.net asp.net-mvc asp.net-mvc-3 asp.net-mvc-4


    【解决方案1】:

    使用Identity.Name试试下面的代码

    @Html.ActionLink(HttpContext.Current.User.Identity.Name, "Index", "Profile")
    

    【讨论】:

      【解决方案2】:

      如果usernamesession 中,则执行以下操作:

      @Html.ActionLink(Session["Username"].ToString(), "Index", "Profile")
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-11-17
        • 1970-01-01
        • 1970-01-01
        • 2022-07-05
        • 2022-01-13
        • 2020-09-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多