I have an issue regarding column editors. This is the scenario:
I have a radgrid with 3 columns. Two of them are GridDateTimeColumns, the other is a GridNumericColumn.
In edit mode (using“PopUp”) I select both dates. As soon as I select the second date I want to calculate the difference between these two dates and place the result (in years) into the NumericColumn. But I do not want to do this in the server side (SelectedDateChanged event). Instead, I want to perform this functionality in the client side in order to make it more “Dynamic” to the user.
My problem is that I have not been able to find an attribute that I can add to the second GridDateTimeColumnEditor in order to fire an event as soon as I select the date from the calendar.
This is what I have so far but does not work as I expected: (the Onclick or Onblur events force me to place focus on the dateinput of the second datepicker in order to fire the calculation. I want this to happen as soon as I select the date.)
sender, GridItemEventArgs e)
GridEditableItem && (e.Item.IsInEditMode))
GridEditableItem item = e.Item
GridDateTimeColumnEditor editorFechaFuga = (GridDateTimeColumnEditor)item.EditManager.GetColumnEditor(
GridDateTimeColumnEditor editorFechaFabrica = (GridDateTimeColumnEditor)item.EditManager.GetColumnEditor(
GridNumericColumnEditor editorTiempoUso = (GridNumericColumnEditor)item.EditManager.GetColumnEditor(
+ editorFechaFuga.PickerControl.ClientID +
+ editorFechaFabrica.PickerControl.ClientID +
+ editorTiempoUso.NumericTextBox.ClientID +
CalculateDiffDate(DPoroID, DFabricaID, CTotalID)
DatePoro = $find(DPoroID).get_selectedDate();
DateFabrica = $find(DFabricaID).get_selectedDate();
TiempoUso = $find(CTotalID);
//Set 1 day in milliseconds
one_day=1000 * 60 * 60 * 24 ;
//Calculate difference btw the two dates, and convert to years
total = Math.ceil((DatePoro.getTime()-DateFabrica.getTime())/(one_day))/365;
I hope my question is clear enough and looking forward to hearing from you guys real soon.
Thanks in advance,