Install .NET 3.5 onto Windows 8

Windows 8 does not have .NET 3.5  Framework installed by default.  Installing it triggered an error 0x800f081F.

http://support.microsoft.com/kb/2734782

The quickest way I took was put in the Windows 8 installation disk to D:\ and enter the following in a Admin command prompt:

   1: Dism /online /enable-feature /featurename:NetFx3 /All /Source:D:\sources\sxs /LimitAccess

Advertisements

ASP.NET MVC ModelState ModelError

Suppose you have messed with the client validation via jquery unobstructive validation and now you cannot save your edited model since it does not POST any more.  Now, your objective is trying to find out which field is failing the validation.

1.  Turn off client validation by setting the following application setting:

<add key="ClientValidationEnabled" value="false" />

2.  At this point, you should be able to post the edited model.  In your controller method, you can verify the model’s valid state

// verify model is valid
if (ModelState.IsValid)

If it is false, then you can use the following code to detect which field is triggering a validation error.

#region Display any Model Error
foreach (var fieldname in this.ModelState.Keys.Where(key => this.ModelState[key].Errors.Count > 0))
{
Debug.Print("Model Field: {0} has an error [{1}].", fieldname, this.ModelState[fieldname].Errors[0].ErrorMessage);
}
#endregion