仅在第一行的Datagrid templatecolumn中隐藏链接按钮

时间:2013-05-02 19:59:57

标签: datagrid hide linkbutton datagridtemplatecolumn itemdatabound

我试图仅在第一行的数据网格中隐藏“删除”链接按钮,但是想在其余行中显示“删除”链接按钮按钮。我怎样才能实现这一点,我们非常感谢任何帮助。

enter image description here

1 个答案:

答案 0 :(得分:0)

找到解决方案。

Private Sub dgRolloverInformation_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRolloverInformation.ItemDataBound
            'Hide "Delete" button for the first row in the RolloverInformation Datagrid
            If (e.Item.ItemIndex = 0) Then
                Dim btnDelete As LinkButton = CType(e.Item.Cells(4).FindControl("lnkbtnDelete"), LinkButton)
                btnDelete.Visible = False
            End If
        End Sub