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

how to get a time from RadTime picker

7 Answers 82 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
SR
Top achievements
Rank 1
SR asked on 14 Oct 2014, 12:09 PM
How to get a time from Rad Time Picker with in  grid using java script function 

7 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 17 Oct 2014, 09:05 AM
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.

 
0
SR
Top achievements
Rank 1
answered on 17 Oct 2014, 09:36 AM
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) {
            }
           
        }


0
Accepted
Eyup
Telerik team
answered on 17 Oct 2014, 09:48 AM
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.

 
0
SR
Top achievements
Rank 1
answered on 17 Oct 2014, 12:00 PM
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.
0
Kostadin
Telerik team
answered on 22 Oct 2014, 06:37 AM
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.

 
0
SR
Top achievements
Rank 1
answered on 28 Oct 2014, 01:16 PM
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.
0
Kostadin
Telerik team
answered on 31 Oct 2014, 09:01 AM
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.

 
Tags
Calendar
Asked by
SR
Top achievements
Rank 1
Answers by
Eyup
Telerik team
SR
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or