MVC3, View I have a label
<label id="test"></label>
and in jquery I set the value on .blur. All works but when I click the submit button to go to the controller and I want to get the data that was displayed in the label, and it shows null.
the way I am retrieving the data is by using FormCollection class
e.g.
public ActionResult Create(FormCollection collection)
collection["test"]
what am I missing?
thx
Labels do not get submitted with a form post.
If you’re updating the value of the label, you might want to also include a hidden input and store the same value there as well. Then access the input in the FormCollection.