Reputation: 9295
I have the following content:
<input type="text" name="val1">
<select name="sel1"><option value="1">one</option><option value="2">two</option></select>
When iterating the formdata using
Request.Form.Allkeys
Both values (val1 and sel1) are inside the keys-List, but while Form["val1"] has the content I entered in the form, Form["sel1"] is always null.
(Using server-controls is not an option in this case)
Upvotes: 0
Views: 352
Reputation: 1045
The reason for that is because there is no value. No value will return null. The issue is with your HTML markup
<select name="sel1"><option>one</option><option>two</option></select>
Should be
<select name="sel1"><option value="one">one</option><option value="two">two</option></select>
Upvotes: 3