Display text in DataGridView when there are no rows
if (dt.Rows.Count > 0) { grid1.DataSource = dt; grid1.DataBind(); } else { dt.Rows.Add(dt.NewRow()); grid1.DataSource = dt; grid1.DataBind(); int totalcolums = grid1.Rows[0].Cells.Count; grid1.Rows[0].Cells.Clear(); grid1.Rows[0].Cells.Add(new TableCell()); grid1.Rows[0].Cells[0].ColumnSpan = totalcolums; grid1.Rows[0].Cells[0].Text = "No Data Found"; }
1 comments:
This is the collection of some of the best free consulting wordpress themes that comes with amazing features.
Post a Comment