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

ClientEvents-OnValueChanged, ClientEvents-OnBlur, or ClientEvents-OnValueChanging not firing

4 Answers 621 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 05 Dec 2008, 08:21 PM
I have attempted to call a client-side JS funciton using:

    ClientEvents-OnValueChanged="clearErrorMsg"
    ClientEvents-OnBlur="clearErrorMsg"
    ClientEvents-OnValueChanging="clearErrorMsg"

and server side using:
    radDatePicker.ClientEvents.OnDateSelected = "clearErrorMsg";
    radDatePicker.DateInput.ClientEvents.OnValueChanged = "clearErrorMsg";
    radDatePicker.DateInput.ClientEvents.OnBlur = "clearErrorMsg";

either way the JS function does not get called. The ClientEvents-OnError="OnError" in the following code works just fine

<script language="javascript">
    function OnError(sender, args) {
        var datePicker = $find(sender.get_id());
        var MinDate = new Date(datePicker.get_minDate());
        var MM_Min = MinDate.getDate();
        var DD_Min = MinDate.getMonth() + 1;
        var YY_Min = MinDate.getFullYear();
        var MaxDate = new Date(datePicker.get_maxDate());
        var MM_Max = MaxDate.getDate();
        var DD_Max = MaxDate.getMonth() + 1;
        var YY_Max = MaxDate.getFullYear();
        var sMinDate = DD_Min + "/" + MM_Min + "/" + YY_Min
        var sMaxDate = DD_Max + "/" + MM_Max + "/" + YY_Max
        //alert("Please enter a valid date between " + sMinDate + " and " + sMaxDate);
        datePicker.focus();
        var errorID = sender.get_id() + "_error";

        if ($("#" + errorID) != null) {
            $("#" + errorID).remove();
        }
        $("#" + sender.get_id()).parent().parent().parent().parent().parent().after('<div id="' + errorID + '" class="valErrorUp DateValError"> Please enter a valid date between ' + sMinDate + ' and ' + sMaxDate + '</div>');
}

function clearErrorMsg(sender, args) {
    alert('got here');
    var datePicker = $find(sender.get_id());
    var errorID = sender.get_id() + "_error";

    if ($("#" + errorID) != null) {
        $("#" + errorID).remove();
    }
}
</script>

<telerik:RadDatePicker ID="radDatePicker" runat="server" Width="100px" CssClass="IndentAnswer" DateInput-FocusedStyle-BackColor="#F1F6FC"  ClientEvents-OnDateSelected="clearErrorMsg">
    <DateInput ClientEvents-OnError="OnError" ClientEvents-OnValueChanged="clearErrorMsg"  ClientEvents-OnBlur="clearErrorMsg" ClientEvents-OnValueChanging="clearErrorMsg"></DateInput>
    <Calendar ViewSelectorText="x" ShowRowHeaders="false" ClientEvents-OnDateSelected="clearErrorMsg"></Calendar>
</telerik:RadDatePicker>

What I am I missing?

Thanks in advance.
Keith

4 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 08 Dec 2008, 08:23 AM
Hi Keith,

Please find attached a simple website which illustrates that the client-side events are called as expected. Give it a try and let me know if I am missing something important.

Best wishes,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Anil Sahu
Top achievements
Rank 1
answered on 31 Aug 2009, 03:09 PM
Hello Team,
           I am using Rad Calendar Control.I am facing one problem,and that is..
          when i am clicking on the Calendar control , its showing me Calender ,
          which is perfect but when i  am clicking on page instead of Date(Date not selected yet),
          I should get Message .
         My main motivation behind this  is , how to get lost focus event of calendar control?
         Rad Calendar control is composite of Textbook(Where selected date is displayed)
         and second is Image(where we click to get select date)
         I used Blur , but here focus should be there in control(calendar) then it is working properly,
        but here once we lost focus from Image control, i should be able to get Message..
Regards,
Anil Sahu

0
DQ
Top achievements
Rank 1
answered on 16 Aug 2012, 11:16 PM
Do we have this resolved yet?  I am running into the same issue here.  It works for a while, and suddenly, the multi-row select stops working and so the allow row selecting.
0
Martin
Telerik team
answered on 20 Aug 2012, 11:44 AM
Hello DQ,

Since your scenario is different than the one this forum thread discusses, please open a formal support ticket providing more details about your case. A sample runnable page or code snippet as well as step by step instructions about how to replicate the issue would also help for the quick resolution of the problem.

Kind regards,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Calendar
Asked by
Keith
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Anil Sahu
Top achievements
Rank 1
DQ
Top achievements
Rank 1
Martin
Telerik team
Share this question
or