我有一个带有 UpdatePanel 和 5 个 GridViews 的页面。我在 Gridview 之外有一个删除按钮,可以快速删除多个文件。是否可以对所有 Gridview 使用一个删除按钮单击事件?
Protected Sub deletePacketBtn_Click(sender As Object, e As EventArgs) Handles deletePacketBtn.Click
'Loop through all the rows in gridview
For Each gvrow As C1GridViewRow In packetGrid.Rows
'Finiding checkbox control in gridview for particular row
Dim chkdelete As CheckBox = CType(gvrow.FindControl("chkDelete"), CheckBox)
'Condition to check checkbox selected or not
If chkdelete.Checked Then
'Getting ID of particular row using datakey value
Dim fileID As Integer = Convert.ToInt32(packetGrid.DataKeys(gvrow.RowIndex).Value)
PacketDataSource.DeleteParameters("original_PKT_Key").DefaultValue = fileID.ToString
PacketDataSource.Delete()
End If
Next
packetGrid.DataBind()
End Sub