如何处理使用ASP.NET MVC很多表单输入字段 [英] How to process many form input fields using ASP.NET MVC
本文介绍了如何处理使用ASP.NET MVC很多表单输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了调查程序,而我,可以有潜在的数百个输入框的形式。我怎么会写控制器来处理这种形式?我不能指定每个输入作为控制器的参数,这是不现实的。
I am writing a survey application, and I have a form that can have potentially hundreds of input fields. How would I write the controller to process this form? I can't specify each input as a parameter for the controller, that would be unrealistic.
我发现了关于MVCToolkit和UpdateFrom()方法,但是这是正确的方式去?如果是的话,我将如何安装MVCToolkit我的应用程序?
I found out about the MVCToolkit, and the UpdateFrom() method, but is this the right way to go? If so, how would I install the MVCToolkit in my app?
推荐答案
它实际上是比这种方式更简单。你只需要使用一个名为对象的FormCollection
。
It is actually way simpler than that. You just need to use an object called FormCollection
.
public ActionResult MyFormUpdate (int id, FormCollection form) {
// do form updates
}
这篇关于如何处理使用ASP.NET MVC很多表单输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文