I have several Textboxes generated via a foreach in the view. To make each textbox unique I appended the item's ID to the name and id of the textbox. Using Ajax.BeginForm to post to a controller with a submit button...
On the controller I want to do "something" with the key/values.
[HttpPost]
public ActionResult Send(FormCollection formCollection)
{
foreach (var key in formCollection.Keys)
{
var value = formCollection[key.ToString()];
...
}
...
}
In the end I wish to either send the values to an email or save to db but not sure how to "parse" and format these key value pairs. The textBoxes are PartNumber and Price but the number of parts are generated dynamically in the view.
Try to have a list of strongly type models bound in your action method so you could write something like
[HttpPost]
public ActionResult Send(List<Item> items)
{
}
You can consult Phil Haack's article for model binding to a list. There are a bunch of articles you can find on this topic; just search for "model binding to list asp.net mvc" and you will find some useful resources.