I am working on a Razor 2 Web Page form. Some elements, to wit: a series of select elements, are created by jQuery and appended to a div based on checkbox selections. Those elements appear on the page's UI and work as expected, but they do not in the page's source view. My problem is that i cannot seem to retrieve the values from these elements. Other elements, modified by Razor at page load, work perfectly. Any ideas on how to get the values of elements created on a javascript event?
You must ensure that you add a name
attribute value to form elements if you want to reference their values on the server following a POST
or GET
request. It is the name
value that acts as a key in Request.Form
and Request.Querystring
collections. If you do not provide a value for name
, the item is not included in the collection.