Results 1 to 15 of 15

Thread: LinkButton in Datalist to delete...verify first?[RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353

    LinkButton in Datalist to delete...verify first?[RESOLVED]

    I have a datalist and I have a LinkButton to delete. This is my code behind that:

    VB Code:
    1. Sub DataList_DeleteCommand(ByVal sender As Object, ByVal e As DataListCommandEventArgs)
    2.         Dim conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings().Item("strConn"))
    3.  
    4.         Dim acctno As String = DataList1.DataKeys(e.Item.ItemIndex)
    5.  
    6.         Dim sql As String = "DELETE FROM CustomerRecords " & _
    7.                             "WHERE ConsumerAccountNumber = '" & acctno & "'"
    8.  
    9.         Dim cmd As New SqlCommand(sql, conn)
    10.         Try
    11.             conn.Open()
    12.             cmd.ExecuteNonQuery()
    13.         Catch ex As Exception
    14.             Response.Write(ex.Message)
    15.         Finally
    16.             If Not conn Is Nothing Then
    17.                 conn.Dispose()
    18.             End If
    19.         End Try
    20.         DataList1.EditItemIndex = -1
    21.         DataBinder()
    22.     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!
    Last edited by brendalisalowe; May 27th, 2005 at 11:19 AM.
    Brenda

    If it weren't for you guys, where would I be?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width