I would like to say that today I passed my next exam 70-492, Upgrade your MCPD: Web Developer 4 to MCSD: Web Applications.
Over the next few months I will try to blog more, now that I've stopped my studying for the time being.
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>