Hi,
I have the following action in my controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, FormCollection formCollection)
{
// do stuff with form collection
}
this works fine. my problem is that when i use a view model object (say MyFormViewModel) no properties contain any form details. e.g. There is one property called MyName
in my form I have a text input field with name="MyName"
the formCollection object above contains an entry for MyName with the correct value
but if i change the code above to:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, String MyName)
{
}
then myName is empty.
Does anyone have any idea why this is the case?
EDIT: The aspx file is:
<form action="/mycontroller/edit" method="post" id="myControllerForm" enctype="multipart/form-data">
<fieldset>
<div class="forms">
<div class="row">
<label> Name: </label>
<span class="input_wrapper">
<%= Html.TextBox("MyName", Model.MyName, new { @class = "text" }) %>
</span>
</div>
<div class="row">
<input name="" type="submit" />
</div>
</div>
</fieldset>
</form>