How to change results per page value in datatables

The fully correct answer would be to use both and display length to 5: $(document).ready( function(){ $(‘#table’).dataTable({ “iDisplayLength”: 5, “aLengthMenu”: [[5, 10, 25, 50, -1], [5, 10, 25, 50, “All”]] }); }); If you use JUST “iDisplayLength”, then the dropdown will not have that length in options later or when the page loads (instead you … Read more

Inline editing in the Angular Material data table

Well this isn’t clean inline editing, but – I’m looking for the same thing – this is close enough for my purposes: https://stackblitz.com/edit/inline-edit-mat-table?file=app%2Fapp.component.html [The idea is to have a small popup when you click on the cell] My alternative Idea would be (though with more work) to replace all cells with Inputfields and bind them … Read more

The source contains no DataRows

ds.Tables[4] might have rows, but the result of your LINQ query might not, which is likely where the exception is being thrown. Split your method chaining to use interim parameters so you can be dead certain where the error is occurring. It’ll also help you check for existing rows using .Any() before you call CopyToDataTable() … Read more

How to read SQL Table data into a C# DataTable

Here, give this a shot (this is just a pseudocode) using System; using System.Data; using System.Data.SqlClient; public class PullDataTest { // your data table private DataTable dataTable = new DataTable(); // your method to pull data from database to datatable public void PullData() { string connString = @”your connection string here”; string query = “select … Read more

How to check if Datarow value is null

Check if the data column is not null with DataRow.IsNull(string columnName) if (!row.IsNull(“Int64_id”)) { // here you can use it safety long someValue = (long)row[“Int64_id”]; } There are overloads for it using the index of the column or if you have the instance of the DataColumn. If you are sure about the index, use the … Read more

Loop through the rows of a particular DataTable

For Each row As DataRow In dtDataTable.Rows strDetail = row.Item(“Detail”) Next row There’s also a shorthand: For Each row As DataRow In dtDataTable.Rows strDetail = row(“Detail”) Next row Note that Microsoft’s style guidelines for .Net now specifically recommend against using hungarian type prefixes for variables. Instead of “strDetail”, for example, you should just use “Detail”. … Read more

How to set width of a p:column in a p:dataTable in PrimeFaces 3.0?

In PrimeFaces 3.0, that style get applied on the generated inner <div> of the table cell, not on the <td> as you (and I) would expect. The following example should work out for you: <p:dataTable styleClass=”myTable”> with .myTable td:nth-child(1) { width: 20px; } In PrimeFaces 3.5 and above, it should work exactly the way you … Read more