detailsView DeleteCommand

Discussion in 'ASP .Net Web Controls' started by savvas.ioannides@gmail.com, Apr 28, 2006.

  1. Guest

    Hi,

    Im not really experienced with web applications. I am using vb.net
    2005. I have a gridview where, when i press the select button, the
    information is shown in detailsView. I chose that because gridview does
    not support delete capabilities. Everything works fine :).

    What I need is simple really. I want to confirm the delete command in
    detailsView before it is triggered.

    I tried the following code:

    Protected Sub dvCountries_ItemCommand(ByVal sender As Object, ByVal e
    As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles
    dvCountries.ItemCommand

    Select Case e.CommandName

    Case "Edit"

    Case "Delete"

    'modValidations.confirmDelete(Me) is a boolean function which returns
    true if the response of
    'the msgbox is true.

    If modValidations.confirmDelete(Me) = True Then
    ' I don't know what code to put here
    Else
    'nothing
    End If
    Case Else
    ' Do nothing.
    End Select
    End Sub

    How can I prevent deletion of the record? Any help would be
    appreciated.

    Thanks

    Savvas
     
    , Apr 28, 2006
    #1
    1. Advertising

  2. clickon Guest

    If you want to cancel you can use the ItemDeleting event and set the e.Cancel
    property to true. Obviously you will need to be able to check for some
    condition within the ItemDeleting event to determine whether or not to cancel
    the delete.

    "" wrote:

    > Hi,
    >
    > Im not really experienced with web applications. I am using vb.net
    > 2005. I have a gridview where, when i press the select button, the
    > information is shown in detailsView. I chose that because gridview does
    > not support delete capabilities. Everything works fine :).
    >
    > What I need is simple really. I want to confirm the delete command in
    > detailsView before it is triggered.
    >
    > I tried the following code:
    >
    > Protected Sub dvCountries_ItemCommand(ByVal sender As Object, ByVal e
    > As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles
    > dvCountries.ItemCommand
    >
    > Select Case e.CommandName
    >
    > Case "Edit"
    >
    > Case "Delete"
    >
    > 'modValidations.confirmDelete(Me) is a boolean function which returns
    > true if the response of
    > 'the msgbox is true.
    >
    > If modValidations.confirmDelete(Me) = True Then
    > ' I don't know what code to put here
    > Else
    > 'nothing
    > End If
    > Case Else
    > ' Do nothing.
    > End Select
    > End Sub
    >
    > How can I prevent deletion of the record? Any help would be
    > appreciated.
    >
    > Thanks
    >
    > Savvas
    >
    >
     
    clickon, Apr 28, 2006
    #2
    1. Advertising

  3. Guest

    Hi,

    Thanks for answering. It worked out fine.
     
    , May 2, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Afonin
    Replies:
    2
    Views:
    468
    Peter Afonin
    Nov 19, 2003
  2. XueWu
    Replies:
    0
    Views:
    650
    XueWu
    Jul 12, 2005
  3. Nathan Sokalski
    Replies:
    4
    Views:
    3,564
    Nathan Sokalski
    May 21, 2006
  4. Guest
    Replies:
    0
    Views:
    540
    Guest
    May 24, 2006
  5. Feege
    Replies:
    0
    Views:
    502
    Feege
    Dec 20, 2005
Loading...

Share This Page