using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace HelloWorldMvcApp
{
public class MyModel {
[HiddenInput(DisplayValue = false)]
public int ModelID { get; set; }
[Required]
public string Model { get; set; }
}
@model HelloWorldMvcApp.MyModel
@using (Html.BeginForm("Method", "Controller")){
<div class="form-group">
@Html.EditorFor(Model => Model, new { htmlAttributes = new { @class = "form-control" }, })
</div>
using System.Collections.Generic;
public class HomeController : Controller
public ActionResult Index()
var model = new MyModel();
return View(model);