Welcome Guest Search | Active Topics | Sign In | Register

Default date 01/01/0001 Options
Raghav Nayak
Posted: Monday, August 25, 2008 7:41:20 AM
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);
}
}

eo_support
Posted: Monday, August 25, 2008 7:44:46 AM
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
Raghav Nayak
Posted: Monday, August 25, 2008 8:09:31 AM
Rank: Advanced Member
Groups: Member

Joined: 8/21/2008
Posts: 37
Hi,

Its working now... Thank you!

Regards,
Raghav


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.