Tuesday 24 January 2012

delete multiple row from gridview as well database also in vb

on button click event write

Here DGListData is your grid viwe name.
the following code for delete multiple record.


  If DGListData.SelectedRows.Count >= 1 Then
            Dim x As Windows.Forms.DialogResult = MsgBox("Are You Sure To DELETE Selected Class Detail ?", MsgBoxStyle.YesNo, "")
            If x = Windows.Forms.DialogResult.Yes Then
                For Each Row In DGListData.SelectedRows
                  'here flagId is your primary key field or may which you use for delete in where condition
Dim flagId As Integer = DGListData.Item(0, Row.index).Value


                Next
            End If
          Else
            MsgBox("Please Select One or More Record", MsgBoxStyle.Information, BasicConfig.MsgInformationTitle) 
  End If

 

No comments:

Post a Comment