using System;
using System.ComponentModel.DataAnnotations;
namespace HelloWorldMvcApp
{
public class SampleViewModel
public bool CheckBox1 { get; set; }
public bool CheckBox2 { get; set; }
}
@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>
using System.Web.Mvc;
using System.Collections.Generic;
public class HomeController : Controller
[HttpGet]
public ActionResult Index()
return View(new SampleViewModel());