couldn't get model in action on post?

后端 未结 1 716
予麋鹿
予麋鹿 2021-01-29 08:11

I have a strongly typed view which has text fields and a submitted link. After editing data I press link and try to submit form. Placing a break point I am able to see control c

相关标签:
1条回答
  • 2021-01-29 08:43

    You should change your button from ActionLink to a submit button like this

    @Html.ActionLink("Submit", "All");
    

    By

    <input type="submit" value="submit"/>
    

    Also change your Action to recieve the data by post

    [HttpPost]
    public ActionResult All(Speaker model)
    {   
        return View(database.Speakers.FirstOrDefault());
    }
    
    0 讨论(0)
提交回复
热议问题