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

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

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 01 Dec 2015, 01:53 PM

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

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 04 Dec 2015, 12:09 PM
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
Tags
Grid
Asked by
Charles
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or