How do i post a dynamic url to a method when using kendo grid with ajax bindings?
@(Html.Kendo().Grid(Model)
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Bound(p => p.SalonName).Groupable(
false
);
columns.Bound(p => p.ServiceName);
columns.Bound(p => p.ResourceName);
columns.Bound(p => p.StartDate).Format(
"{0: yyyy-MM-dd}"
).Title(
"Datum"
);
columns.Bound(p => p.StartDate).Format(
"{0:hh:mm}"
).Title(
"Tid"
);
columns.Bound(p => p.Duration);
columns.Command(command => command.Custom(
"Detaljer"
).Click(
"BookingDetails"
));
columns.Command(command => command.Custom(
"Avboka"
).Click(
"confirmBookingRemoval"
));
})
.Pageable()
.Sortable()
.Scrollable()
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"ReadBookings"
,
"Kund"
))
.ServerOperation(
true
)
.PageSize(25))
.Events(events => events.Change(
"grid_selected"
))
)
<script type=
"text/javascript"
>
function BookingDetails(arg) {
var grid = $(
'#Grid'
).data(
'kendoGrid'
);
var dataItem =
this
.dataItem($(arg.currentTarget).closest(
"tr"
));
var id = dataItem.AppointmentID;
window.location.href =
"@Url.Action("
Detaljer
", "
@User.SalonKey/Boka
")"
+
"/"
+ id;
};
</script>