@Ajax.ActionLink(
"Attachemnts",
"ShowAttachments",
"Board",
new { id = 1 },
new AjaxOptions
{
UpdateTargetId = "result",
InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace,
HttpMethod = "GET"
})
On Controller side we need to have Get method which shall return partial view,
[HttpGet]
public ActionResult ShowAttachments(int id)
{
ViewBag.UserName = HttpContext.User.Identity.Name;
BoardAttachmentService srvBa = new BoardAttachmentService();
List<BoardAttachment> baLst = srvBa.GetBoardAttachmentsByBoardId(id).ToList();
List<BoardAttachmentVM> BoardAttVM = Mapper.Map<List<BoardAttachment>, List<BoardAttachmentVM>>(baLst).ToList();
return PartialView("_ShowAttachments", BoardAttVM);
}
"Attachemnts",
"ShowAttachments",
"Board",
new { id = 1 },
new AjaxOptions
{
UpdateTargetId = "result",
InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace,
HttpMethod = "GET"
})
On Controller side we need to have Get method which shall return partial view,
[HttpGet]
public ActionResult ShowAttachments(int id)
{
ViewBag.UserName = HttpContext.User.Identity.Name;
BoardAttachmentService srvBa = new BoardAttachmentService();
List<BoardAttachment> baLst = srvBa.GetBoardAttachmentsByBoardId(id).ToList();
List<BoardAttachmentVM> BoardAttVM = Mapper.Map<List<BoardAttachment>, List<BoardAttachmentVM>>(baLst).ToList();
return PartialView("_ShowAttachments", BoardAttVM);
}
No comments:
Post a Comment