加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET MVC 3中的c# – @ Html.ActionLink

发布时间:2020-12-16 04:18:11 所属栏目:asp.Net 来源:网络整理
导读:我在.cshtml中的操作链接是这样的: @Html.ActionLink("Reply","Post_Reply",new { item.ID,item.Post_ID,item.Reply_ID }) 我在控制器中的方法是这样的: [Authorize] public ActionResult Post_Reply(int PostId=0,int Id = 0,int ReplyId = 0) { post pos
我在.cshtml中的操作链接是这样的:
@Html.ActionLink("Reply","Post_Reply",new { item.ID,item.Post_ID,item.Reply_ID })

我在控制器中的方法是这样的:

[Authorize]    
public ActionResult Post_Reply(int PostId=0,int Id = 0,int ReplyId = 0)   
{   
    post posts = new post();    
    posts.ID = Id;    
    return View(posts);   
}

但只有item.ID的值被传递,
另外两个值item.Post_ID和item.Reply_ID没有被传递..
任何人都可以指导我..
谢谢..

解决方法

看起来你正在为@ Html.ActionLink使用错误的重载:

尝试:

@Html.ActionLink("Reply",new { Id = item.ID,PostId = item.Post_ID,ReplyId = item.Reply_ID },null)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读