Results 1 to 3 of 3

Thread: Return confirm from Datagrid Delete button

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Unhappy Return confirm from Datagrid Delete button

    I have a datagrid with a delete button. The delete part works, what I want is a confirm button that says are you sure with an ok or cancel button.

    Anyone have an ideas on this. I tried to put an onclick even in this line
    Code:
    <asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
    This did not work.

    Thanks
    Last edited by indydavid32; Oct 25th, 2004 at 11:52 AM.
    David Wilhelm

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    I tried this...
    VB Code:
    1. Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
    2.         DataGrid1.Controls.Add(New LiteralControl("<SCRIPT FOR=""" & e.Item.Controls(8).ClientID.ToString() & """ EVENT=""onclick"" Language=""JavaScript"">if(!confirm('Are you sure?')){return false; window.event.cancelBubble=true;}</SCRIPT>" & vbCrLf))
    3.     End Sub
    No confirm button is popping up when I click the delete button. I believe the column # should be 1, I tried 0 through 8.
    David Wilhelm

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    Bump
    David Wilhelm

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