C# create DataTable
DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("Name");
dt.Columns.Add("Marks");
DataRow _ravi = dt.NewRow();
_ravi["Name"] = "ravi";
_ravi["Marks"] = "500";
dt.Rows.Add(_ravi);
C# create DataTable
DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("Name");
dt.Columns.Add("Marks");
DataRow _ravi = dt.NewRow();
_ravi["Name"] = "ravi";
_ravi["Marks"] = "500";
dt.Rows.Add(_ravi);
datatable
<link href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
<script src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<table id="Table_ID">
<thead>
<tr>
<th>Table_Head_1</th>
<th>Table_Head_2</th>
<th>Table_Head_3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Table_Data_1</td>
<td>Table_Data_2</td>
<td>Table_Data_3</td>
</tr>
</tbody>
</table>
<script>
$(document).ready( function () {
$('#Table_ID').DataTable();
} );
</script>
dataTables
//datatable customization
//#datatable will be replace with your table id or class following jqurey code formet
$('#datatable').dataTable({
"lengthChange": true,
"dom": '<"top"i>rt<"bottom"flp><"clear">',
"lengthMenu": [[10,25, 50, 100, 500, 1000],[10,25, 50, 100, 500, "Max"]],
"pageLength": 10,
});
//dom is for changing position of the selecting lentgh menu field
//lengthmenu is for defining ranges
//pagelenth is the values or entity that will be shown at the time of load #firstview
datatable in c#
String[] arr = new String[] { "a", "b" };
DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("other");
dt.Rows.Add(arr);
foreach (DataRow r in dt.Rows)
{
Console.WriteLine(r["name"].ToString() + " - " + r["other"].ToString());
}
datatable
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.22/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.22/datatables.min.js"></script>
how to make a datatable in c#
Datatable NameHere = new DataTable();
NameHere.Rows.Add("Whateveryoudliketoaddintorstringoranything");
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us