[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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