I am tring update a record and want to exclude one column from the update, i have this field that is populated with GetDate() as a default value in sql, so when the update takes place i want this field to be left as it is,
[ScaffoldColumn(false)]
[Column] public DateTime RegisteredDate { get; set; }
Ive tried using both ScaffoldColumnFalse from dataannotaions and HiddenInput(DisplayValue = false) but when i try to save the changes an error is thrown
sqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
From what i understand this is thrown due to a null value being passed to the RegisterdDate field,
Ive also tried using bind Exclude in the ActionResult stub to no avail
public ActionResult Edit([Bind(Exclude = "RegisteredDate")] Customer customer)
Anyone any ideas on where I am going wrong here?
Kind Regards
Liam
Have a look at Steve Sandersons blog, Partial Validation in ASP.NET MVC 2. His approach is to validate only incoming values from the view. This may work in your case.