In asp.net mvc5 i have this telerik grid
@(Html.Kendo().Grid<KerberosTest.Models.Bench>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))).Width(150);
//columns.Bound(p => p.seatsCount).Title("Total Seats");
//columns.Bound(p => p.bookedSeats).Title("Booked Seats");
columns.Bound(p => p.seatsCount).Title("Total Seats").Width(150).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
columns.Command(command => command.Custom("checkBench").Text("Check in").Click("ShowTimePopup")).Width(160).Title("Check in");
})
i want to know if when i press the button and call ShowTimePopup, i can read the first column value (the one with p => p.name) of the same row as the button i clicked
It's pretty ease to get the current row's data if you use grid.dataItem($(this).closest("tr"));
<script type="text/javascript">
function ShowTimePopup()
{
var grid = $("#grid").data("kendoGrid");
var rowData = grid.dataItem($(this).closest("tr"));
alert(rowData.name);
}
</script>