MVC - Pass entire model as parameter to Url.Action in javascript

前端 未结 2 2025
我寻月下人不归
我寻月下人不归 2020-12-04 02:03

Can I pass the entire model as a parameter to Url.Action orsimilar?

Actually, I pass a parameter to the controller and I load the model, but I would like to pass ent

2条回答
  •  自闭症患者
    2020-12-04 02:51

    You can try passing a ViewBag instead:

    Url.Action("Search", "Song", new { songId = ViewBag.SongId, songName = ViewBag.SongName})
    

    Controller:

    [HttpGet]
            public PartialViewResult Search(String songId, String songName)
            {
    

提交回复
热议问题