• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Web App msgbox equivalent

Hi,

     On my screens, if the user chooses to delete a record, I want to flash them a quick verification question.  In a windows app this is done with MsgBox, but my web app doesn't like it.  What's the equivalent?  I just want to ask "Are you sure you want to delete this item?" and give them a yes/no option.

JP
0
gleznov
Asked:
gleznov
  • 2
1 Solution
 
GlomCommented:
Hi,
I have been searching for such a thing a long time too. And the best solution I found is the following code. Put this in the Form.Load event to add a property to your target control that requires confirmation:

BtnDelete.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this element ?');")

Hope this will help.

Glom
0
 
gleznovAuthor Commented:
How do I handle a yes or a no?

JP
0
 
CJ_SCommented:
You do not handle a yes or no answer from the dialog box because it runs on the client. Adding an onClick attribute to your button will run on the client, and only when pressed yes.

With other words, the BtnDelete_Click event will only be fired after the user clicked 'yes' on the dialog.

Points to Glom.

CJ.
0
 
gleznovAuthor Commented:
Thanks to you both!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now