I have this scenario to implement in ASP.Net MVC.
In my view, I would like to have a dropdown with a button , where on click of Button, will add selected values into probably a Div table. There will be a separate 'Save' button which will call the ActionResult POST method to save these values to the database.
Here, I could probably use AJAX to add values into the Div (However I am not sure how I can pass the values here to the controller once user clicks on the 'Save' button).
I was also thinking I could probably do a postback and add the values into a Session value (Probably an ASP.Net Web Form technique?) and call the ActionResult POST Method once the user clicks a separate 'Save' button.
Hence, in an ASP.Net MVC framework, what would be the best way to implement this scenario?
Thanks.
您可以将所有的hml放入一个@html表单中,然后在保存时单击即可将其发布到服务器上,也可以通过进行ajax调用来编写该表单的click事件。在ajax调用中,您可以按表单发送表单数据.serialize方法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.