【问题标题】:dynamic generation of datagrid from the code-behind从代码隐藏动态生成数据网格
【发布时间】:2015-12-07 15:44:33
【问题描述】:

您好我有两个asp:datagrid xy,我将数据加载到datagrid x中, 我想跳过 x 的数据键与 y 的数据键匹配的 datagrid y 中的行。我有适当的逻辑在 datagrid yitemdatabound 事件中,但无法找出当 datakey 与 datagrid x 中的一个匹配时跳过整行的方法。有人可以帮我解决这个问题吗

【问题讨论】:

  • 你能告诉我们你试图做什么
  • 我们需要查看数据网格的迭代。
  • y 数据网格中的数据必须有一些条件,因此您可以从数据不在您的y 查询的表中选择数据。
  • 如何绑定数据网格?如果你在后面的代码中绑定它们?显示一些关于如何绑定它们的代码。
  • 感谢您的 cmets,我发现 e.Item.Visible = False' 对我有用

标签: asp.net vb.net datagrid


【解决方案1】:

下面是你需要实现的逻辑:-

Private Sub DataGridView1_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles DataGridView1.RowsAdded

    If (row need to be removed) then
        DataGridView1.Rows.Remove(DataGridView1.Rows(e.RowIndex))
    End If

End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-26
    • 1970-01-01
    • 1970-01-01
    • 2021-03-28
    相关资源
    最近更新 更多