if (dt.Rows.Count > 0)
{
     GridView1.DataSource = dt;
     GridView1.DataBind();
}
else
{
     dt.Rows.Add(dt.NewRow());
     GridView1.DataSource = dt;
     GridView1.DataBind();
     int columnCount = GridView1.Rows[0].Cells.Count;
     GridView1.Rows[0].Cells.Clear();
     GridView1.Rows[0].Cells.Add(new TableCell());
     GridView1.Rows[0].Cells[0].ColumnSpan = columnCount;
     GridView1.Rows[0].Cells[0].Text = "目前还没有数据";
}

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2021-06-30
  • 2022-01-11
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案