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

click template column in grid to load another grid and list/table

1 Answer 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
B
Top achievements
Rank 1
B asked on 26 Mar 2014, 05:35 PM
I have a kendo grid which is populated form the database(works all fine) now when I click the "select" template column in the grid I want it to route to another page that has two controls:
a kendogrid and a list/table(both populated using sprocs ffrom database by passing in the productid from 1st grid)
How do I achieve this? I only get the json data in raw form on the page and not in the table..and I am not sure how to populate the list/table

​$(document).ready(function () {
var pId = '@(Model.ProductId)';
$.ajax({
type: "POST",
url: '@(Url.Action("GetDetails", "Search"))',
data: JSON.stringify({ ProductId: pId }),
contentType: "application/json; charset=utf-8",
dataType: "JSON",
success: function (data) {
$('#DetailsGrid').data('kendoGrid').dataSource.fetch();
},
});
});

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 28 Mar 2014, 11:40 AM
Hello,

If the current Grid is using an Ajax binding, you could use it's dataItem method to retrieve the model (and the id) of the current item. Here is a sample implementation of the click handler of the button.
E.g.
$("#grid").on("click", ".myButton", function (e) {
    var grid = $("#grid").data("kendoGrid");
    var row = $(this).closest("tr");
    var model = grid.dataItem(row);
    var id = model.OrderID;
});

The exact navigation afterwards depends on the current requirements.A sample approach would be to navigate and pass the id as a get parameter. Then when implementing the read action of the new Grid, you could use the approach demonstrated here for passing additional data to the action when binding the Grid and pass the id of the item from the previous Grid.

Regards,
Dimiter Madjarov
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
B
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or