我的控制器:
[HttpGet]
public ActionResult AddEstablishment()
{
return View("AddEstablishment",new EstablishmentModel());
}
我的模型:
public class EstablishmentModel
{
[Display(Name = "Establishment ID")]
public Guid EstablishmentId { get; set; }
.............
我的 AddEstablishment 视图:
@Html.TextBoxFor(x => x.EstablishmentId, new { @id = "inputEstGuid", @class = "input input-xlarge", @placeholder = "5C3B1CBC-2574-4E2A-A9FA-A8CA0041AB86" })
结果:
我的文本框预填充了 Guid 默认值
00000000-0000-0000-0000-000000000000
我怎样才能避免它?
请注意,我将模型实例传递给视图的原因很明显。