Adding Confirmation Message on DATAGRID Item Delete

Discussion in 'ASP .Net' started by rajeshgujar@hotmail.com, Jun 14, 2007.

  1. Guest

    Here is What needs to be Done

    In Your DataGrid do this

    1 ] Private Sub DGReference_ItemDataBound(ByVal sender As Object,
    ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
    DGReference.ItemDataBound

    e.Item.Cells(5).Attributes.Add("onclick", "return
    confirmDelete (this.form);") // If its the 5 th Column in the
    Datagrid

    End Sub


    2 ] Private Sub DGReference_EditCommand(ByVal source As Object, ByVal
    e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    DGReference.EditCommand, DGReference.DeleteCommand
    Select Case (CType(e.CommandSource, LinkButton)).CommandName
    Case "Delete"
    /// Give Your Delete Database Logic Here
    End Select
    End Sub


    3 ] In the HTML Code in the Head Section

    <script language="javascript">
    function confirmDelete (frm)
    {
    return confirm ('Are you sure you want to delete ?')

    }

    </script>

    You Should be all set .

    Hope It Helps
     
    , Jun 14, 2007
    #1
    1. Advertisements

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. Nedu N
    Replies:
    2
    Views:
    474
    Robert McLaws
    Dec 4, 2003
  2. JenHu
    Replies:
    6
    Views:
    5,442
    =?Utf-8?B?UGF1bCBK?=
    Feb 3, 2005
  3. DrData
    Replies:
    4
    Views:
    6,983
    Patrick Olurotimi Ige
    Mar 22, 2005
  4. Elton W
    Replies:
    0
    Views:
    3,440
    Elton W
    May 15, 2005
  5. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    Client Side Confirmation on DataGrid "Delete" LinkButton

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, May 2, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    9,980
    AcesHidden
    Nov 23, 2010
  6. Peter Afonin

    Javascript confirmation message in datagrid

    Peter Afonin, Aug 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    922
    =?Utf-8?B?UGV0ZXIgQWZvbmlu?=
    Aug 15, 2007
  7. Nedu N

    Datagrid Item Delete Confirmation not working

    Nedu N, Dec 3, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    250
    Robert McLaws
    Dec 4, 2003
  8. Mike Brearley

    adding delete confirmation

    Mike Brearley, Jul 6, 2004, in forum: ASP General
    Replies:
    4
    Views:
    373
    Mike Brearley
    Jul 6, 2004
Loading...