Im trying to exclude a required property(Password) so the modelstate dont validate that property, but for some reason it still validate even when i try to exclude it.
Controller:
[Authorize, AcceptVerbs(HttpVerbs.Post)]
public ActionResult _Edit(int id, [Bind(Exclude = "Password")]FormCollection collection)
{
var user = Proxy.GetUser(id);
TryUpdateModel(user, null, null, new[]{"Password"});
if(!ModelState.IsValid)
return PartialView(user);
Proxy.UpdateUser(user);
}
View:
...
<tr>
<td class="label">
<label class="row_description" for="Password"><%= S._("Password")%></label>
</td>
<td>
<%= Html.Password("Password", null, new { @class = "row_input" })%>
<%= Html.ValidationMessage("Password", "*")%>
</td>
</tr>
User(using dataannotation):
[Required]
public string Password { get; set; }
Im using VS2008, MVC2, firefox
Maybe im just tired and can't see it. Any help is appreciated