Hello,
My grid has a column called "vessel_idx" that shows all the IDs relating to each vessel(obviously), each row also has a button that calls my own Javascript function. I need to pass the value of the vessel_idx into this function, does anyone know how I can accomplish this?
Here is my grid with the required column and button as described above.
@(Html.Kendo().Grid<MyProject.ViewModels.SpotGridViewModel>() .Name("Grid") .Deferred() .Columns(columns => { columns.Bound(c => c.vessel_idx); columns.Template(@<text></text>) .ClientTemplate("<ul class='grid-options'>" + "<input type='button' id='mybtn' value='Prompt' />"+ "</ul>").Width(200); }))Here is my javascript code that I need to pass the vessel_idx into
$("#Grid").on("click", "#mybtn", function (e) { var id = vessel_idx; $.ajax({ url: "@Url.Action("buttonPrompt", "Home")", type: "GET", data: { id: id }, dataType: 'json', cache: false, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Error" + errorThrown); console.log(errorThrown); }, success: function (data) { console.log("yay"); } }); });Many thanks