Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 526.3k

"No Data available in table" should not be displayed.

Sep 10 2024 11:19 AM

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.

StringBuilder htmlTable = new StringBuilder();
            htmlTable.Append("<table class='table table-bordered table-hover datatable-highlight' id='tbldata'>");
            htmlTable.Append("<thead><tr style='background-color:green;color:white; text-align: center;'><th>Sr.</th><th>Document</th><th>File Name</th><th class='text-center nosort'>Action</th></tr></thead>");
            htmlTable.Append("<tbody>");
            htmlTable.Append("</tbody>");
            htmlTable.Append("</table>");
            PlaceHolderTable0.Controls.Add(new Literal { Text = htmlTable.ToString() });

Thanks


Answers (6)