Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get problem with error of datetime not getting value when i run program. I do set value at control like this

C#
public ActionResult CálculoData(DateTime DataInic = default(DateTime))
{


but erro message tell me

Server Error in '/' Application.
Encountered an invalid type for a default value.
Posted
Comments
Suk@nta 7-Apr-14 9:26am    
you should change default(datetime) to DateTime.Now

1 solution

I think you might have the same problem as what i saw somewhere else.

Apparently this is a bug that they have reported where there is only an error at run time.
Try this

C#
public ActionResult CálculoData(DateTime? DataInic = DateTime.Now)
{
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900