Web App msgbox equivalent

Posted on 2004-10-25
Last Modified: 2010-04-24

     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.

Question by:gleznov
    LVL 4

    Accepted Solution

    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.


    Author Comment

    How do I handle a yes or a no?

    LVL 22

    Expert Comment

    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.


    Author Comment

    Thanks to you both!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    884 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now