c# - 数据不存在时隐藏 Gridview

标签 c# asp.net visual-studio visual-studio-2008 gridview

我有一个 Gridview,它具有可以触发空数据模板的过滤器。然而,当它显示时,我仍然可以看到我的 gridview 的轮廓。当数据不存在时,如何使 Gridview 消失?

最佳答案

protected void GridView1_DataBound(object sender, EventArgs e)
{
    if (this.GridView1.Rows.Count == 0)
      this.GridView1.Visible = false; 
}

关于c# - 数据不存在时隐藏 Gridview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1314189/

相关文章:

c# - 使用 asp.net 图表控件的线和点

asp.net - 如何使用标签正确对齐网页上的文本框

c# - 在 C# 中显示带有换行符的标签文本

c++ - 如何在 C++ 中使用旧的 iostream.h (Visual Studio 2010)

c++ - VS2010中的常量问题

c# - Linq to Entities 4.0 - 优化查询并在单个查询中多次调用数据库

c# - 打印Pdf文档C#字体生成的Barcode

c# - ADO.NET 中断开连接和连接方法的确切含义是什么

c# - Entity Framework 中的联盟

visual-studio - 如何将 Intellisense 支持添加到新语言的 Visual Studio