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. 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. sramruttun

    Re: delete confirmation in datagrid

    sramruttun, Jul 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    609
    sramruttun
    Jul 4, 2003
  2. Nedu N
    Replies:
    2
    Views:
    383
    Robert McLaws
    Dec 4, 2003
  3. Elton W
    Replies:
    0
    Views:
    3,289
    Elton W
    May 15, 2005
  4. Nedu N

    Datagrid Item Delete Confirmation not working

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

    adding delete confirmation

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

Share This Page