This may very well turn out to be a very stupid question, but basically I have this “form” in the model, which is tied to my view as a form, but I was not able to actually transfer any data from the view. It has only two properties: the Id property and the String property. I tried to populate the String property with text from a hidden text field on the page with no luck.
Form Code:
public class AllocateListForm { public int Id { get; set; } public virtual string HiddenText { get; set; } }
Corresponding view code:
<% using (Html.BeginForm("SaveExit", "User", new { }, FormMethod.Post, new { id = "selectExitPoints" })) { %> <fieldset> <input type="hidden" id="HiddenText" /> </fieldset> <% } %>
There is jQuery behind the scenes that fills the HiddenText text with text, and I can assure you that it is being filled. There is also jQuery behind the scenes that does the Ajax presentation, and I can promise you that this code works because it is used elsewhere in the application without any problems. When I perform an action that sends the form to the server, and I go to my controller code that it points to, I have a breakpoint, so I can go to the console and check if there is any data in the HiddenText field on the form zero. Can someone point me in the right direction?
Jfabs source share