How can a formcollection be enumerated in ASP.NET MVC?

后端 未结 6 1892
南旧
南旧 2020-11-29 20:28

How can I enumerate through all the key/values of a FormCollection (system.web.mvc) in ASP.NET MVC?

6条回答
  •  抹茶落季
    2020-11-29 21:07

    foreach(KeyValuePair kvp in form.ToValueProvider())
    {
        string htmlControlName = kvp.Key;
        string htmlControlValue = kvp.Value.AttemptedValue;
    }
    

提交回复
热议问题