I have a datalist and I have a LinkButton to delete. This is my code behind that:
VB Code:
Sub DataList_DeleteCommand(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Dim conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings().Item("strConn")) Dim acctno As String = DataList1.DataKeys(e.Item.ItemIndex) Dim sql As String = "DELETE FROM CustomerRecords " & _ "WHERE ConsumerAccountNumber = '" & acctno & "'" Dim cmd As New SqlCommand(sql, conn) Try conn.Open() cmd.ExecuteNonQuery() Catch ex As Exception Response.Write(ex.Message) Finally If Not conn Is Nothing Then conn.Dispose() End If End Try DataList1.EditItemIndex = -1 DataBinder() End Sub
I was just wondering if there is a way to have a MessageBox pop saying "Do you want to do this: Yes or No"?
I'm assuming JavaScript or something maybe? let me know. Thanks!




Reply With Quote