TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Darfer
NA
17
2.3k
DateTime column not automaticaly updated
Sep 27 2016 2:33 AM
I work on an Entity Framework 6.1.3, ASP.NET MVC 5, Code First with an existing databse project. My database (SQL Server 2016) includes a table with a “ModifiedDate” (datetime, DEFAULT (getdate)) column. When trying to create a new record in browser the server applies the value automatically as it should be done.
Unfortunately, when I update an existing record the old ModifiedDate value as it is shown in the textbox is applied (not the current date). Moreover, the ModifiedDate textbox should always be inactive to the user, both when creating or editing a record (i.e. the user shouldn’t be allowed to enter a value himself).
This is the model class for the “Title” table:
public
partial
class
Title
{
public
int
TitleID {
get
;
set
; }
[Column(
"Title"
)]
[Required]
[StringLength(50)]
public
string
Title1 {
get
;
set
; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public
DateTime? ModifiedDate {
get
;
set
; }
}
Any suggestions would be appreciated.
Darfer
Reply
Answers (
16
)
While Install window service Show Below Error
How to save IpAddress in NLog