Hi
I have below data which converts table into datatable. I want if there is no record "No Data available in table" should not be displayed.
C#
StringBuilder htmlTable = new StringBuilder();
htmlTable.Append("");
htmlTable.Append("Sr.DocumentFile NameAction");
htmlTable.Append("");
htmlTable.Append("");
htmlTable.Append("");
PlaceHolderTable0.Controls.Add(new Literal { Text = htmlTable.ToString() });Thanks

Jignesh KumarRank #91 · 22.9K reputationPosted Sep 10, 2024, 8:02 AM EDT
Hello Ramco,
I cannot see a message like "No Data available in table" in your code.
Could you please share the full code if you are facing that issue? As per the above code there is no message like that
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 10, 2024, 8:33 AM EDT
You can use this,
$(document).ready(function() { $('#example').DataTable({ "language": { "emptyTable": "" // Empty string to hide the message } }); });Jignesh KumarRank #91 · 22.9K reputationPosted Sep 11, 2024, 5:11 AM EDT
$(document).ready(function() { var table = $('#example').DataTable(); if ($.fn.DataTable.isDataTable('#example')) { table.destroy(); } $('#example').DataTable({ "language": { "emptyTable": "" // Empty string to hide the message } }); });Ramco RamcoRank #462 · 5.4K reputationPosted Sep 10, 2024, 8:07 AM EDT
Hi Jignesh
Datatable by default does not display this message. Am i right
Thanks
Ramco RamcoRank #462 · 5.4K reputationPosted Sep 10, 2024, 12:26 PM EDT
Hi Jignesh
I am getting error - Cannot reinitialize table
Thanks
Vijay Pandey122 reputationPosted Oct 5, 2024, 2:09 AM EDT
Protected Sub BindDataToGridView() Dim dt As DataTable = GetData() ' Check if the DataTable has records If dt.Rows.Count > 0 Then ' Bind the GridView GridView1.DataSource = dt GridView1.DataBind() ' Optionally hide the EmptyDataText GridView1.EmptyDataText = String.Empty Else ' No data available, you can still display a custom message or do nothing GridView1.Visible = False End If End Sub