View
@model DatePickerTemp.Models.FooEditModel
@{
ViewBag.Title = "Edit";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
Edit</h2>
@Model.Message
@using (Html.BeginForm())
{
@Html.EditorFor(m => m.Foo)
<input id="submit" name="submit" type="submit" value="Save" />
}
Models
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using DatePickerTemp.Infrastructure;
namespace DatePickerTemp.Models
{
public class Foo
{
public string Name { get; set; }
[DataType(DataType.Date)]
public DateTime Date1 { get; set; }
[DateRange(Min = "2010/12/02")]
public DateTime Date2 { get; set; }
[DateRange(Max = "2010/12/20")]
public DateTime Date3 { get; set; }
[DateRange(Min = "2010/12/02", Max = "2010/12/20")]
public DateTime Date4 { get; set; }
}
}
namespace DatePickerTemp.Models
{
public class FooEditModel
{
public string Message { get; set; }
public Foo Foo { get; set; }
}
}
DatePicker.zip
@model DatePickerTemp.Models.FooEditModel
@{
ViewBag.Title = "Edit";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
Edit</h2>
@Model.Message
@using (Html.BeginForm())
{
@Html.EditorFor(m => m.Foo)
<input id="submit" name="submit" type="submit" value="Save" />
}
Models
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using DatePickerTemp.Infrastructure;
namespace DatePickerTemp.Models
{
public class Foo
{
public string Name { get; set; }
[DataType(DataType.Date)]
public DateTime Date1 { get; set; }
[DateRange(Min = "2010/12/02")]
public DateTime Date2 { get; set; }
[DateRange(Max = "2010/12/20")]
public DateTime Date3 { get; set; }
[DateRange(Min = "2010/12/02", Max = "2010/12/20")]
public DateTime Date4 { get; set; }
}
}
namespace DatePickerTemp.Models
{
public class FooEditModel
{
public string Message { get; set; }
public Foo Foo { get; set; }
}
}
DatePicker.zip