The solution I found was to install the following extension.
Extension Manager -> Online Gallery
Search for: "Web Standards Update for Microsoft Visual Studio 2010 SP1"This information I found on the social MSDN site here.
Extension Manager -> Online Gallery
Search for: "Web Standards Update for Microsoft Visual Studio 2010 SP1"[Test]
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home",
action = "Index",
id = UrlParameter.Optional }
);
[Test]
public void DefaultRouteTest()
{
var routes = new RouteCollection();
var application = new Application();
application.RegisterRoutes(routes);
var context = new Mock<httpcontextbase>();
context.Setup(p => p.Request.AppRelativeCurrentExecutionFilePath)
.Returns("~/");
var routeData = routes.GetRouteData(context.Object);
Assert.AreEqual(((Route)routeData.Route).Url,
"{controller}/{action}/{id}");
Assert.AreEqual("Home", routeData.Values["controller"]);
Assert.AreEqual("Index", routeData.Values["action"]);
}
<Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" />
$('#myDataTable').dataTable().makeEditable({
sUpdateURL: "/Home/UpdateData"
})
public class HomeController : Controller
{
public string UpdateData(int id, string value,
int? rowId, int? columnPosition,
int? columnId, string columnName)
{
//Add code to update cell
return value;
}
}
Code borrowed from http://code.google.com/p/jquery-datatables-editable/wiki/EditCell
I've been using MVC3 for a new site and require a check box to be true before continuing. e.g. "Accept T & Cs".
The data annotation have the [Required] attribute for other field types, but this is ignored for check boxes.
You can create your own custom validators. Below is an example for a single check box to ensure it is true.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class MustBeTrueAttribute : ValidationAttribute
{
public override bool IsValid(object value)
{
return value != null && value is bool && (bool)value;
}
}
You can then add the attribute to your MVC component model
[Display(Name = "I accept the terms and conditions")]
[MustBeTrue(ErrorMessage = "Please accept terms and conditions before continuing")]
public bool AcceptTerms { get; set; }
This solution was discovered on StackOverflow
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://www.yourdomain.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
devenv /log
<entry>
<record>208</record>
<time>2012/01/17 15:06:00.310</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [Visual Studio Class Designer Package]</description>
<guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
</entry>
<entry>
<record>209</record>
<time>2012/01/17 15:06:00.412</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [Visual Studio Class Designer Package]</description>
<guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
<hr>8000ffff - E_UNEXPECTED</hr>
<errorinfo>Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))</errorinfo>
</entry>
<entry>
<record>210</record>
<time>2012/01/17 15:06:00.415</time>
<type>Error</type>
<source>VisualStudio</source>
<description>End package load [Visual Studio Class Designer Package]</description>
<guid>{DD1683A7-5A4C-4234-81B3-A4CC91DBEAC9}</guid>
<hr>8000ffff - E_UNEXPECTED</hr>
<errorinfo>Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))</errorinfo>
</entry>
Now start Visual Studio with devenv /ResetSettings