問題描述
如何從 ASP .NET MVC 中的動態生成控件中獲取數據? (How can I get data from dynamic generated controls in ASP .NET MVC?)
I want to generate a couple of checkboxes on an ASP .NET MVC page. How can I retrieve their data in a controller after posting the page?
‑‑‑‑‑
參考解法
方法 1:
Use the Request.Form
collection:
Request.Form["control‑id"]
or declare a FormsCollection
parameter in your action method and use it to retrieve the value.
(by Stefan Filip、mmx)