Add this line of code after Page_Load sub in your code behind, assuming that you named 
your delete button "btnDelete".

btnDelete.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to 
delete this item?')== false) return false;")




  _____  


Zehra Altug | Intranet Applications Developer | Information Technology Group | Media 
General, Inc. | Tel: (804) 649-6149



-----Original Message-----
From: sas0riza [ mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 4:02 PM
To: [EMAIL PROTECTED]
Subject: [AspNetAnyQuestionIsOk] How to Confirm a Delete in an ASP.NET
Datagrid


I would like to delete a record, but only after confirmation.

I have this JS function:

<script language="javascript">
function confirm_delete()
{
  if (confirm("Are you sure you want to delete this item?")==true)
    return true;
  else
    return false;
}
</script>


How do I incorporate it into my code?






Yahoo! Groups Links









[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to