@(Html.EJ().Grid("Binding") .Datasource((IEnumerable)ViewBag.datasource) . . . . .Columns(col => col.HeaderText("Edit").Commands(command => .ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties()
Click = "onEditClick" }).Add();
<script type="text/javascript"> function onEditClick(args) { var grid = $("# Binding ").ejGrid("instance"); var index = this.element.closest("tr").index(); //For getting clicked rowElement(tr) index var record = grid.getCurrentViewData()[index]; //For getting the record by passing the row index var primaryKeyValue=record[i_banner_id]; //Here i_banner_id is primarykey column. } |
<script>
function onEditClick(args) {
var grid = $("# Binding ").ejGrid("instance");
//getIndexByRow method
var index = grid.getIndexByRow(this.element.closest("tr")); //For getting clicked rowElement(tr) index
var record = grid.getCurrentViewData()[index];
var primaryKeyValue = record[i_banner_id];
}
</script> |