Delete confirmation from asp:ImageButton

Posted on 2005-04-23
Medium Priority
Last Modified: 2010-08-05
I would like to ask the user to confirm (yes/no) if they really want to delete this record after they have clicked the image button.

<asp:ImageButton runat="server" ImageUrl="images/imgDelete.gif" ToolTip="Delete" OnClick=""/>

How can I add code to the OnClick event to enable this confirmation. Do I need to use javascript also ? Can someone please show me an example. Preferred web language is (VB.NET). Thanks.
Question by:naveenraj
1 Comment

Accepted Solution

sansoftura earned 500 total points
ID: 13851007

1) Give and ID for the image button (in this case ImageButton1)
2) On ImageButton1_Click write the code for delete
3) Add the following gode in Page_Load event

Dim sConfirmMsg As String = "return confirm('Are you sure you want to delete?');"
ImageButton1.Attributes.Add("onclick", sConfirmMsg)

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question