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

[Solved] CleintEvents for datetimepicker not firing

0 Answers 25 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex P.
Top achievements
Rank 1
Alex P. asked on 20 Jan 2012, 07:10 PM
I have a grid with bound columns, 2 of the bound columns have a template which includes a DateTimePicker as such:

                               columns.Bound(r => r.EffectiveDate).Title("Effective Date").Template(
                                                                r => string.Format("<div>{0}</div>",
                                                                                                        Html.Telerik().DateTimePicker().Name("DateTimePicker")
                                                                                                                                .Value(r.EffectiveDate).Interval(5)
                                                                                                                                .ClientEvents(ce => { 
                                                                                                                                    ce.OnChange("DateTimePicker_onChange");
                                                                                                                                    ce.OnOpen("DateTimePicker_onOpen");
                                                                                                                                })
                                                                                                                                )).Title("Effective Date");
                               columns.Bound(r => r.EndDate).Title("End Date").Template(
                                                                r => string.Format("<div>{0}</div>",
                                                                                                        Html.Telerik().DateTimePicker().Name("DateTimePicker")
                                                                                                                                .Value(r.EndDate).Interval(5)
                                                                                                                                .ClientEvents(ce =>
                                                                                                                                {
                                                                                                                                    ce.OnChange("DateTimePicker_onChange");
                                                                                                                                    ce.OnOpen("DateTimePicker_onOpen");
                                                                                                                                })
                                                                                                                                )).Title("End Date");
                               
the problem that i'm having is that none of the javascript functions assigned to the events are not getting fired. These are the functions.
    function DateTimePicker_onOpen() {
        alert("DateTimePicker_onOpen... is fired");
    }
    
    function DateTimePicker_onChange(e) {
        alert('inside the DateTimePicker_onChange event...');
        var dateTimePicker = $(this).data('tDateTimePicker'); // $(this) is equivalent to $('#DateTimePicker')
        var value = e.value;
        alert('date value:  ' + value);
        var valid = !isNaN(e.valueOf());
        alert('valid:  ' + valid);
        var previousValue = e.previousValue;
    }
        
i need to get to these functions to assign some (http://craigsworks.com/projects/qtip2/demos/ 
) error in case the user manually type in the wrong date when editing the data, in the date column.  Thanks for your help
Tags
Date/Time Pickers
Asked by
Alex P.
Top achievements
Rank 1
Share this question
or