|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
I just upgraded to 2013, eo.web. I have had problems with the date controls in the past. I use the datepicker control to display a time control. I am using the mask: "hh:mm tt". I am dynamically creating the control in the simplest of pages. I create the control in OnInit and set the SelectedDate attribute to the DateTime.Now. This is the first problem, it does not set anything, the field remains blank. It used to. I use the SelectedDate attribute, has that changed?
Next problem, you can type the time in the field, however on any postback the time is cleared. Probably because you cannot set anything in the field. Therefore, the time control is no longer usable.
I went to try and break your sample application, but it no longer runs. Gives a development server error. It also used to work.
I am the programmer who found the inability to clear a time field bug. Now it appears as though nothing can be set in the time field.
Here is the code to build the time control, very simple:
base.id = "Time_Control"; datemask = "hh:mm tt";
dp = new DatePicker(); dp.ID = base.id; dp.PickerFormat = datemask;
date_value = DateTime.Now;
dp.PickerStyle.CssClass = base.ctrl_cssclass; dp.SelectedDate = date_value; if (time_only) dp.PopupImageVisible = false;
Sorry about this, please advise. I will now work on a simple example to show that a date control cannot be cleared dynamically with a postback event. Within our system now, when you dynamically disable a control, that control is cleared. This works for every type of control (dropdown, radio, textbox, etc) except the eo date control, because it cannot be cleared dynamically. You will hear from me about that one soon too.
Sorry about this, as programmers it is tough to trap every possible bug. We do appreciate your efforts.
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
I tested the date control and it now clears. I am guessing my version was out of date when it was happening to me and not EO. Any word on a possible build for this time issue using the datepicker control? We have a scheduled release coming up. Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We have confirmed this to be a bug on our side and posted a new build that should fix the problem. Please see your private message for the download location.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
You guys are awesome, thanks again!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
You are very welcome. Please feel free to let us know if there is anything else.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Ok, only 1 problem left. This is not an EO bug. How do I find out if the above datepicker field is actually blank? Remember, I am only using the time portion of the field. When I do a standard FindControl and then use the selecteddate attribute to get the date, it returns a DateTime field. If the field is entered as blank, that DateTime field is identical to if a user entered 12:00 AM. Is there any way to query this control and figure out if the user entered 12:00 AM or if they entered a blank field. Perhaps the edit control text can be returned?
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
I have done some further analysis; the SelectedDateString attribute which is returned by the datepicker is an empty string when the date field is empty. However, it is still an empty string when the user enters 12:00 AM. Therefore, the time control appears to have the same problem as I am having. There appears to be no way to differentiate between a blank value and 12:00am. Unfortunately, 12:00am is a real time and not a blank value. Please advise and thanks again for your help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Yes. This is a known issue. The root of the problem is DateTime value being a value type and there is no way to represent a null value (empty) value. We would have to add another property (such as IsEmpty) on the control in order to distinguish these two situations. We will add this in our next build.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Any time frame on that, even just a ballpark estimate? Right now my users are unaware of this anomaly because nobody has actually had a time of 12:00 am. But sooner or later they will notice. Thanks again!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We have posted a new build that should address this issue. In the new build the Year portion of the SelectedDate value is used to indicate whether it's blank or not. A value of "1/1/1 12:00AM" would represent a blank value. However a value of "1/1/2013 12:00AM" would represent "12:00AM". Note the difference on the year. While the current implementation always return the current year number in a non-blank value, you should only check whether the year is "1" or not. If the year is "1", then it's a blank value. This is consistent with the behavior when the DatePicker contains date: the unified rule is "if SelectedDate == DateTime.MinValue" then the DatePicker is blank.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Yep, works perfectly, excellent solution. Thanks again!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
You are very welcome. Please feel free to let us know if there is anything else.
Thanks!
|
|