Wednesday, June 16, 2010

SharePoint DateTimeControl returns today's date if there is no selected date

By Default SharePoint DateTimeControl returns today's date if there is no selected date. Use IsDateEmpty to check whether user selected any date or not. If IsDateEmpty returns true, means no date selected by the user otherwise user selected the date and use that date.

 

 

if (!((DateTimeControl)c).IsDateEmpty)
{
    columnValue = ((DateTimeControl)c).SelectedDate.ToString();
}
else
{
    columnValue = "";
}

1 comments:

Bam Manguera said...

it`s work for me! really thanks!

Post a Comment