I still have a developer edition available to me in my downloads and was wondering. In the grid can one tell the edit button to go to another controller / action ?
Regards
3 Answers, 1 is accepted
0
Neli
Telerik team
answered on 05 Aug 2020, 03:44 PM
Hello David,
If I understand the issue correctly when the 'Edit' button in the Grid is clicked you need to send an additional request. If this is the case, you could subscribe to the Grid beforeEdit or edit event. In the respective event handler, you could send an ajax request to the needed endpoint. Below is an example:
Hi no that is not what i want to achieve I want the edit command column to go to another controller view
0
Neli
Telerik team
answered on 10 Aug 2020, 11:53 AM
Hi David,
As far as I understand the requirements, you need to redirect to another page when the 'Edit' button is clicked, instead of displaying the Grid in one of the built-in edit modes.
If this is the scenario, I would suggest you subscribe to the dataBound event. In the event handler, you could prevent the default behavior and redirect to another view. Below you will find such example:
function onDataBound(e) {
overrideEditCommand(this);
}
function overrideEditCommand(grid) {
$('.k-grid-edit').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
var dataItem = grid.dataItem($(e.target).closest('tr'));
window.location.href = "/Home/Edit?id=" + dataItem.OrderID;
})
}
I hope you will find the provided suggestion helpful. Let us know in case you have additional questions.