This question is locked. New answers and comments are not allowed.
Telerikers,
I do have a radgridview with one RadDateTimepicker control on it. the RadDateTimepicker control binds it correctly in EDIT mode. However, when the data returns as minvalue from DB (1/1/0001), I would like to hide it and keep the RadDateTimepicker box blank.
See attachment for details. http://i12.photobucket.com/albums/a201/le9569/1-3.png
Your guidance is appreciated.
John.
I do have a radgridview with one RadDateTimepicker control on it. the RadDateTimepicker control binds it correctly in EDIT mode. However, when the data returns as minvalue from DB (1/1/0001), I would like to hide it and keep the RadDateTimepicker box blank.
See attachment for details. http://i12.photobucket.com/albums/a201/le9569/1-3.png
Your guidance is appreciated.
John.
4 Answers, 1 is accepted
0
John
Top achievements
Rank 1
answered on 26 Oct 2010, 03:47 AM
For those who need solution, change the DateTime type to DateTime? type in the object. It would do the trick.
0
Hello John,
In addition to this use the SelectedValue as a recommendation instead of the SelectedDate.
Kind regards,
Kaloyan
the Telerik team
In addition to this use the SelectedValue as a recommendation instead of the SelectedDate.
Kind regards,
Kaloyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Edward
Top achievements
Rank 1
answered on 15 Jun 2011, 03:33 PM
Just wondering if anyone has some other solution? Since the database column is not nullable, the entity model just sue DateTime instead of DateTime?. So everytime I try to create a new object it will be bound to the MinValue.
0
Edward
Top achievements
Rank 1
answered on 16 Jun 2011, 08:30 PM
Add a converter should work:
public class MinDateConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) return null; if (value.GetType() == typeof(DateTime)) { var d = DateTime.Parse(value.ToString()); if (d == DateTime.MinValue) return null; return d; } return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { // Not needed; if (value == null) return DateTime.MinValue; return value; }}