Solved

Web App msgbox equivalent

Posted on 2004-10-25
166 Views
Last Modified: 2010-04-24
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
Question by:gleznov
    4 Comments
     
    LVL 4

    Accepted Solution

    by:
    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
     

    Author Comment

    by:gleznov
    How do I handle a yes or a no?

    JP
    0
     
    LVL 22

    Expert Comment

    by:CJ_S
    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
     

    Author Comment

    by:gleznov
    Thanks to you both!
    0

    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 (http://msdn.microsoft.com/en-us/library/system.string.aspx) 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 (http://www.enterprise.efax.com), 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