0

I have the following time picker in a Kendo grid:

 columns.Bound(s => s.StartTime).Title("Start Time").Width(76).ClientTemplate((
    @Html.Kendo().TimePicker()
        .Name("StartTimePicker" + "#=ID#")
        .Format("HH:mm:ss")
        .Interval(15)
        .HtmlAttributes(new { data_bind = "value: StartTime" })
        .ToClientTemplate()).ToHtmlString());

This works as intended. I also have the following button in the grid:

columns.Command(command => command.Custom("Save").Text("<span class=\"k-icon k-i-check\"></span>Save").Click("saveSchedule")).Width(80).HtmlAttributes(new { @class = "text-center" });

I want to access the value of the time picker in my saveSchedule function, which is:

function saveSchedule(e) {
        e.preventDefault();

       // etc

       // need code to get time here

How do I get the time that was selected in the grid?

Scott
  • 2,456
  • 3
  • 32
  • 54

1 Answers1

0

I added this to my saveSchedule function:

var timepicker = $(e.currentTarget).closest('tr').find('.k-input');
schedule.StartTime = timepicker[0].value;

Solved the issue.

CMartins
  • 3,247
  • 5
  • 38
  • 53
Scott
  • 2,456
  • 3
  • 32
  • 54