My action link in .cshtml is like this:
@Html.ActionLink("Reply", "Post_Reply", new { item.ID, item.Post_ID, item.Reply_ID })
and my method in controller is like this:
[Authorize]
public ActionResult Post_Reply(int PostId=0, int Id = 0, int ReplyId = 0)
{
post posts = new post();
posts.ID = Id;
return View(posts);
}
but only value of item.ID is getting passed, other two values item.Post_ID and item.Reply_ID are not getting passed.. Can anyone please guide me.. thanks..
Looks like you are using the wrong overload for @Html.ActionLink
:
Try:
@Html.ActionLink("Reply", "Post_Reply", new { Id = item.ID, PostId = item.Post_ID, ReplyId = item.Reply_ID }, null)
The problem is that when you add in parameter values to an action link you must ALSO add Html Attributes, use this:
@Html.ActionLink("Reply", "Post_Reply", new { Id = item.ID, PostId = item.Post_ID, ReplyId = item.Reply_ID }, null)
Adding the Null
value for Html Attributes will allow the correct parameters to be sent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With