c# datatable get row data code example

Example 1: jquery datatables get selected row data

var table = $('#example').DataTable();
 
$('#example tbody').on( 'click', 'tr', function () {
    console.log( table.row( this ).data() );
} );

Example 2: c# datatable current row

CurrencyManager cm = (CurrencyManager) this.BindingContext[this.gridDataBoundGrid.DataSource, this.gridDataBoundGrid.DataMember];
DataRow dr = ((DataRowView) cm.Current).Row;
this.label1.Text = dr["Col"].ToString();

Example 3: get row data in datatable

Javascript12345var table = $('#example').DataTable(); $('#example tbody').on( 'click', 'tr', function () {    console.log( table.row( this ).data() );} );