GenesysStack.com
RSS

Blog posts tagged with 'mvc'

How-to Fix: A Downloaded Project Compile Error: Could not load file or assembly packages\ … or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Could not load file or assembly packages\ … or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) Cause: The \packages folder and/or files is blocked. Fix: Backup and Delete the solution’s \packages\ folder, allowing NuGet to restore packages.
How-to fix: Mvc Error CS0012 The type is definied in an assembly that is not referenced
After deploying a MVC project to the dev web server, a new partial view based on @model List<> began to throw the following exceptions: ·         Error    CS0012            The type 'DateTime' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. ·          Error   CS0012            The type 'List<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' The fix was to alter the following block in your Mvc project root web.config: From: To:                                
Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class?
Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class? By default, the DataContractJsonSerializer class expects dates in the format of Date(ticks). This is problematic, because ASP.NET Web API returns dates in ISO 8601 format. * Default date: "{\"BirthDate\":\\\/Date(248860800000-0800)\\/\ * ISO 8601 date: "{\"BirthDate\":\"1982-11-16T00:00:00-08:00\"}"
Did You Know that you can clear MVC TextboxFor default values?
If you like strongly-typed Views...the trick is the Value Html attribute. Not “value”, “Value”. For example: @Html.TextBoxFor(m => m.BirthDate, "{0:MM/dd/yyyy}", new { @id = "txtBirthDate", @class = "form-control BirthDate", @Value = Model.BirthDate == "01/01/1900" ? "" : Model.BirthDate.ToString(), @placeholder = "MM/DD/YYYY" })