Display value not updating

2 posts, 0 answers
  1. Nordy
    Nordy avatar
    14 posts
    Member since:
    Aug 2007

    Posted 11 Feb 2008 Link to this post

    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; 

  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 12 Feb 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top