title: ASP.NET confirm delete in a grid
body: <p>I need to add a confirm delete action to a grid. the problem is the way the "Delete" link is rendered.
  my grid is built in code behind in vb.net.
  i have this</p>
  
  <pre><code>colDelete.AllowDelete = True
  colDelete.Width = "100"
  AddHandler CType(gridSavedForLater, Grid).DeleteCommand, AddressOf dgDeleteSelectedIncident
  </code></pre>
  
  <p>and the sub is the following</p>
  
  <pre><code>Sub dgDeleteSelectedIncident(ByVal sender As Object, ByVal e As GridRecordEventArgs)
  
      Dim message As String = "Are you sure you want to delete this incident?"
      Dim caption As String = "Confirm Delete"
      Dim result = System.Windows.Forms.MessageBox.Show(message, caption, Windows.Forms.MessageBoxButtons.OKCancel, Windows.Forms.MessageBoxIcon.Warning)
  
      'If (result = Windows.Forms.DialogResult.Cancel) Then
      'Else
      ' MessageBox("Are you sure you want to delete this incident?")
      'Get the VehicleId of the row whose Delete button was clicked
      'Dim SelectedIncidentId As String = e.Record("IncidentId")
  
      ''Delete the record from the database
      'objIncident = New Incidents(SelectedIncidentId, Session("userFullName"))
  
      'objIncident.DeleteIncident()
      ''Rebind the DataGrid
      LoadSavedForLater()
      ''        End If
  
  End Sub
  </code></pre>
  
  <p>i need to add a javascript confirm dialog when this sub is called. i can do it with a windows form messagebox but that does not work on the server.</p>
  
  <p>pleae help
  joe</p>