【问题标题】:Hide DataGrid Rows After particular number of rows在特定行数之后隐藏 DataGrid 行
【发布时间】:2013-11-14 12:15:42
【问题描述】:

我有一个数据网格,它绑定并给了我 12 行。 我想隐藏第 7 行之后的所有行。

有什么建议吗?

【问题讨论】:

  • 你想隐藏它们,还是根本不渲染它们?
  • 能否提供一些代码示例?
  • 我只想隐藏特定行数之后的行,在这种情况下,在绑定数据表中的数据后为 7。
  • 最好的方法是添加一个带有 display:none 的 CSS 类到你想在服务器代码中隐藏的行
  • 我尝试将它隐藏在 ItemDataBound 事件中,但它适用于特定单元格而不是整行

标签: c# asp.net datagrid


【解决方案1】:

试试这个:

if (e.Row.RowType == DataControlRowType.DataRow)
    {
 int index = e.Row.RowIndex;

if(index>7)
{
dataGridView1.Rows(index ).Visible = False
}
   }

【讨论】:

    猜你喜欢
    • 2010-09-30
    • 2014-11-30
    • 2020-12-08
    • 2011-04-24
    • 1970-01-01
    • 2012-01-13
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    相关资源
    最近更新 更多