I have a section of the form that I need to handle differently than the rest of the form results. In the section requiring special processing, I need to iterate over 3 fields of the form with the same name. They must have the same name, I canβt change it. The section of the form that I am referencing looks something like this:
<td><input name="Color" size="20" value="" type="text"></td> <td><input name="Color" size="20" value="" type="text"></td> <td><input name="Color" size="20" value="" type="text"></td>
With C #, I try something like this:
I am trying to handle this as follows:
int i; for (i = 1; i <= Request.Form["Color"][i]; i++) { colorName.Text += Request.Form["Color"]; }
This results in the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
How do I handle form fields with the same name?
itsatrp
source share