Retrieve all posted values in ASP.NET

后端 未结 2 402
闹比i
闹比i 2021-01-04 20:04

I am creating an ASP.NET application that allows the user to add form elements to a page within a form. When the page is posted (via the submit button) I need to loop throug

2条回答
  •  执念已碎
    2021-01-04 20:43

    The Request.Form property returns a NameValueCollection you can iterate over:

    foreach (string name in Request.Form.AllKeys) {
        string value = Request.Form[name];
        // Do something with (name, value).
    }
    

提交回复
热议问题