SharePoint DateTime control returning Today date when no date is selected

Leave a Comment
Hi All,

In One of my Projects i am using  SharePoint DateTime control.

I got  the selected date by the user using "SelectedDate" property of the sharePoint DateTime control.

The problem is that even when the user has not selected any date in the sharePoint DateTime control, the "SelectedDate" property of the sharePoint DateTime control returns Today's date.

for this we have to check ,

if (dtSpSelectedDate.IsDateEmpty)
{
//will insert the default value set to the column
SPFieldDateTime actualDate = SPFieldDateTime)SPContext.Current.Web.Lists["XX"].Fields["Actual End Date"];
sList["Actual_x0020_End_x0020_Date"] = actualDate.DefaultValue;
}
else
{
sList["Actual_x0020_End_x0020_Date"] = dtSpSelectedDate.SelectedDate;
}

Related Post

0 comments:

Post a Comment