how to get a time from RadTime picker

8 posts, 1 answers
  1. SR
    SR avatar
    33 posts
    Member since:
    Dec 2013

    Posted 14 Oct 2014 Link to this post

    How to get a time from Rad Time Picker with in  grid using java script function 
  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 17 Oct 2014 Link to this post

    Hello,

    Once you have a reference to the client-side object of the control:
    http://www.telerik.com/help/aspnet-ajax/calendar-client-side-basics.html

    You can use the get_selectedDate() method to get the requested information:
    http://www.telerik.com/help/aspnet-ajax/calendar-client-side-rad-timepicker.html

    Hope this helps.

    Regards,
    Eyup
    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. SR
    SR avatar
    33 posts
    Member since:
    Dec 2013

    Posted 17 Oct 2014 in reply to Eyup Link to this post

    Hello,

    I am using this function but unable to get time from time picker can u check this 
     function OnDateSelected(tpCheckIn, tpCheckOut) {
                // access the control and set the label value
                var grid = $find("<%= grid.ClientID %>");
                try {              
                    var tableView = grid.get_masterTableView();
                    var items = tableView.get_dataItems();
                    for (var i = 0; i < items.length; i++) {
                        var rowValues = items[i];
                        var pkr1= rowValues.findElement("picker1");
                        var pkr2= rowValues.findElement("picker2");               
                        var time = pkr1.get_selectedDate();// here i am getting the error "Object doesn't support property or method 'get_selectedDate'"
                        //var time = pkr1.get_selectedDate();/using this one also unable to get the time from picker

                    }
                }
                catch (e) {
                }
               
            }


  5. Answer
    Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 17 Oct 2014 Link to this post

    Hello,

    Please try using the findControl method instead of findElement and let me know about the result.

    Regards,
    Eyup
    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. SR
    SR avatar
    33 posts
    Member since:
    Dec 2013

    Posted 17 Oct 2014 in reply to Eyup Link to this post

    Thanks Eyup

    it's working but i have to show pkr2 text with redcolor y bcz pkr2 time should be greater than pkr1,
     when user enter wrong time text should be shows with redcolor.

    Regards 
    SR.
  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 22 Oct 2014 Link to this post

    Hello SR,

    You can access the TextBox by using the _dateInput private property and change the styles. Please check out the following code snippet.
    var input1 = pkr1._dateInput;
    var input2 = pkr2._dateInput;

    Regards,
    Kostadin
    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.

     
  8. SR
    SR avatar
    33 posts
    Member since:
    Dec 2013

    Posted 28 Oct 2014 in reply to Kostadin Link to this post

    can you please elaborate the steps please 
        var timepicker1= rowValues.findControl("pkr1");
        pk1= timepicker1.get_selectedDate();// here i am getting the selected time but unable to set text color as red    
                                                                      using the javascript function .


    Regards,
    SR.
  9. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 31 Oct 2014 Link to this post

    Hello SR,

    There is a property which display the date as invalid. I would recommend you to use it in your case. For this purpose you have to use the following approach.
    function OnDateSelected(sender, args) {
        var timepicker1 = rowValues.findControl("pkr1");
        timepicker1.get_dateInput().set_invalid(true)
    }

    Regards,
    Kostadin
    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.

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