javascript reference for checking datachanged

5 posts, 0 answers
  1. Bill
    Bill avatar
    4 posts
    Member since:
    Jan 2014

    Posted 13 Mar 2015 Link to this post

    I'm running a script on window.onbeforeunload to check to see if the form is 'dirty'

    this works for asp controls:

    $('select').bind('change', function (event) { dataChanged = 1 })
    $('input').bind('input', function (event) { dataChanged = 1 })

    but I can't find an equivalent for a radComboBox or radDatePicker.
    Anybody running this check?

    Thanks
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 18 Mar 2015 Link to this post

    Hi Bill,

    You will have to use the pageLoad event. It will be fired after all ajax control are initialized. 
    <script type="text/javascript">
        function pageLoad() {
            var dp = $find("datePicker");
            var selectedDate = dp.get_selectedDate();
        }
    </script>
    <div>
        <telerik:RadDatePicker runat="server" ID="datePicker"></telerik:RadDatePicker>
    </div>


    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bill
    Bill avatar
    4 posts
    Member since:
    Jan 2014

    Posted 19 Mar 2015 in reply to Hristo Valyavicharski Link to this post

    Thanks Hristo,

    But that's not quite what I was looking for. 
    I'd like to be able to generically check all radcomboboxes and raddatepickers rather than naming each one.
    I'd like to have a script that I can apply to all pages rather than having to specify each control.

    I can do that for html/asp controls using the $('select').bind call.

    Does that make sense?

    Thanks,
    Bill



  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 20 Mar 2015 Link to this post

    Hi Bill,

    What does it mean to "check" all comboboxes and raddatepickers? If you want to get reference of all combos and datepickers on the page you can use the following code:


    var combos = Telerik.Web.UI.RadComboBox.ComboBoxes;
    var inputs= $(".RadInput");

    if you want  to attach event handler then you can define one event and attach it to all combos or datepickers.

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Bill
    Bill avatar
    4 posts
    Member since:
    Jan 2014

    Posted 20 Mar 2015 in reply to Hristo Valyavicharski Link to this post

    That's what I was looking for.

    Thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017