Checkbox Error

CSharp · Mvc

Model

using System;
using System.ComponentModel.DataAnnotations;

namespace HelloWorldMvcApp
{
	public class SampleViewModel
	{
		public bool CheckBox1 { get; set; }
		public bool CheckBox2 { get; set; }
	}
}

View

@model HelloWorldMvcApp.SampleViewModel
@{
	Layout = null;
}

<!DOCTYPE html>
<!-- template from http://getbootstrap.com/getting-started -->

<html lang="en">
	<head>
	</head>
	
	<body>
		@Html.CheckBoxFor(x => x.CheckBox1)
		@Html.HiddenFor(x => x.CheckBox2)
	</body>
</html>

Controller

using System;
using System.Web.Mvc;
using System.Collections.Generic;

namespace HelloWorldMvcApp
{
	public class HomeController : Controller
	{
		[HttpGet]
		public ActionResult Index()
		{
			return View(new SampleViewModel());
		}
	}
}
;