我需要將確認刪除操作添加到網格。問題在於「刪除」鏈接的呈現方式。 我的網格是在vb.net後面的代碼中構建的。 我有這個ASP.NET確認在網格中刪除
colDelete.AllowDelete = True
colDelete.Width = "100"
AddHandler CType(gridSavedForLater, Grid).DeleteCommand, AddressOf dgDeleteSelectedIncident
和子是以下
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
我需要添加一個JavaScript確認對話框時,該子被調用。我可以使用Windows窗體消息框來實現,但這在服務器上不起作用。
pleae幫助 喬
您只需編寫一個JavaScript函數來處理按鈕的onclick事件,並根據提示結果阻止/允許回發。 – MarioDS