RadDateTimePicker in RadGrid cannot be edited if beyond Max/Min Date

2 posts, 0 answers
  1. Charles
    Charles avatar
    9 posts
    Member since:
    Aug 2015

    Posted 01 Dec 2015 Link to this post

    I have a RadGrid with a handful of GridTemplateColumns which have EditItemTemplates with RadDateTimePickers. The content is loaded dynamically on the backend and the MasterTableView's EditMode="PopUp". When selecting the edit button, if a date is within the min/max of 1980-2099, the popup displays appropriately. When a value is not within the min/max values, the page flashes and the edit popup does not display.

    I've tried the following:

    - Modified the Min/Max of the raddatepickers in the edititemtemplates

    - Modified the Min/Max of the raddatepickers when assigning the data in the ItemCreated event and the picker's prerender event.

    - Added SkipMinMaxDateValidationOnServer to the item in the edititemtemplate as well as in the ItemCreated event.

    - Added DateInput-SkipMinMaxDateValidationOnServer to the item in the edititemtemplate as well as in the ItemCreated event.

     

    None of these fixes the problem and allows the edit popup to display, at all. When I use a raddatetimepicker outside of the radgrid I'm able to modify the max/min on the ASPX as well as the code and get the expected results. Is there something I'm missing?

     

    Thanks,

    Chuck

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 04 Dec 2015 Link to this post

    Hello Charles,

    Try accessing the picker in ItemDataBound event and modify the values there, like this:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
           {
               GridEditableItem edititem = (GridEditableItem)e.Item;
               RadDatePicker pkr = (RadDatePicker)edititem["Date"].Controls[0];
               pkr.MaxDate = DateTime.Parse("12/12/3000");
               pkr.MinDate = DateTime.Parse("12/29/0001");
           }
       }

    Give this a try and see how it goes.

    Regards,
    Maria Ilieva
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top