MVC5 date problem

Hi Everyone, me again.

Same project and related date question:

When I CREATE a new record I would like the record field date to default to today's date. I can get other field's to default to a specific value except the date.

In my controller I have used a ViewBag (ViewBag.CURRENTDATE) to hold today's date:
MVC_CONTROLLER.png

In my view I have to following code:
MVC_VIEW.jpg

The output is correct EXCEPT for the DATE fields??!:
MVC_VIEW01.png

Can someone show me where I went wrong?

Thanks.
 
Hi Everyone, me again.

Same project and related date question:

When I CREATE a new record I would like the record field date to default to today's date. I can get other field's to default to a specific value except the date.

In my controller I have used a ViewBag (ViewBag.CURRENTDATE) to hold today's date:
View attachment 392538

In my view I have to following code:
View attachment 392540

The output is correct EXCEPT for the DATE fields??!:
View attachment 392542

Can someone show me where I went wrong?

Thanks.

I found the answer here: http://stackoverflow.com/questions/16561889/how-to-set-default-value-html-editorfor
:)
 
Top
Sign up to the MyBroadband newsletter
X