Rank: Advanced Member Groups: Member
Joined: 8/21/2008 Posts: 37
|
Hi,
Due to some technical problem, we are storing the date as string in the database. If the date is not selected then, empty string should be saved. While binding the empty string to the date picker control, it should not crash. Earlier we were using some free javascript calendar. But now since we're using the Eo:DatePicker, the default values(01/01/0001) are being stored in the database. These default dates will be displayed while building the report.
Is there any way, so that I can pass the empty string instead of default date, and also retrieve the empty string later.
I'm using the date picker as user control. Below are the lines of code in the user control.
Regards, Raghav
// This propery sets/gets the calendar date public string CalendarDate { get { return DatePicker1.SelectedDate.ToShortDateString(); } set { DatePicker1.SelectedDate = Convert.ToDateTime(value); } }
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, You can just test for that value in your code. For example:
Code: C#
get
{
if (DatePicker1.SelectedDate == DateTime.MinValue)
return null;
else
return DatePicker1.SelectedDate.ToShortDateString();
}
Thanks
|
Rank: Advanced Member Groups: Member
Joined: 8/21/2008 Posts: 37
|
Hi,
Its working now... Thank you!
Regards, Raghav
|