This is a migrated thread and some comments may be shown as answers.

Display value not updating

1 Answer 125 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Nordy
Top achievements
Rank 1
Nordy asked on 11 Feb 2008, 06:37 PM
On my Windows form, I have a RadDateTimePicker control.  When I first load the form, I'm retrieving data from our database, based on the value of a .NET ComboBox control, and populating the RadDateTimePicker control from a date column in the return result set.  If I then change the value in my ComboBox, which initiates a fresh hit to the database, and the date column is null, it clears the RadDateTimePicker control as I want it to.

The problem comes when I change the ComboBox back to the value it was when the form first loaded, forcing a retrieval of the original data.  The RadDateTimePicker control stays empty, even though the Value property has a valid date.

If I click the drop down arrow of the RadDateTimePicker control at this point, the text suddenly fills in with the correct date.  Here's the code I'm using:

// Create PMA object 
ProductMarketArea pma = new ProductMarketArea(); 
// Retrieve product data 
DataTable tbl = pma.GetRecordsByProductID(CurrentProduct.ID.Value); 
// Get specific PMA data. 
DataRow row = tbl.Select("MarketAreaID = " + CurrentMarketArea.MarketAreaID.ToString() + " And Expiration Is Null")[0]; 
// Populate PMA object with PMA data. 
pma.LoadFromDataRow(row); 
_ProductMarketArea = pma; 
 
EventHandler datesChanged = DatesChanged; 
rdpStartDate.ValueChanged -= datesChanged; 
rdpEndDate.ValueChanged -= datesChanged; 
 
// rdpStartDate and rdpEndDate are the two RadDateTimePicker controls 
if (pma.StartDate.HasValue) 
   rdpStartDate.Value = pma.StartDate.Value; 
else 
   rdpStartDate.Value = DateTime.Now; 
 
// PROBLEM SEEMS TO BE HERE.  END DATE STAYS VISUALLY EMPTY AFTER RECORD CHANGE 
if (pma.EndDate.HasValue) 
   rdpEndDate.Value = pma.EndDate.Value; 
else                 
   rdpEndDate.Value = rdpEndDate.MinDate; 
 
rdpStartDate.ValueChanged += datesChanged; 
rdpEndDate.ValueChanged += datesChanged; 

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 12 Feb 2008, 07:27 AM
Hello Jamie,

Thank you for contacting us.
Have you tried setting the rdpEndDate Value property to something different than the MinDate?
This may be the problem as the NullDate property by default is equal to the MinDate property of RadDateTimePicker. I hope this helps.

Please do not hesitate to write me back if you need more assistance.

Greetings,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Nordy
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or