Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 10:33 AM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default "confirm" dialog before processing dropdown event

I'm trying to get a confirm dialog box to fire before processing a dropdownbox 'onselectedindexchange' event.

I have a dropdownbox:

<asp:DropDownList ID="drpSelAction" Runat="server" OnSelectedIndexChanged="drpSelAction_SelectedIndex Changed" AutoPostBack="True">
        <asp:ListItem Text="Select Action..." Value="" />
        <asp:ListItem Text="" Value="" />
        <asp:ListItem Value="Edit Move Project" />
        <asp:ListItem Text="" Value="" />
        <asp:ListItem Value="Add Employees To Move">
        </asp:ListItem>
        <asp:ListItem Text="" Value="" />
        <asp:ListItem Value="Delete Selected Employee Moves" />
        <asp:ListItem Value="Cancel Selected Employee Moves" />
        <asp:ListItem Value="Reactivate Selected Employee Moves" />
    </asp:DropDownList>

If the user selects "Delete Selected Employee Moves" I would like to have the drpSelAction_SelectedIndexChanged in the code-behind page prompt the user to confirm that they want to delete.

Here's the event code:

 public void drpSelAction_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (drpSelAction.SelectedValue)
        {
            case "Delete Employees":
                delSelectedMoves();
                break;
            case "Cancel Employee Moves":
                cnclSelectedMoves();
                break;
        case "Uncancel Employee Moves":
        uncnclSelectedMoves();
        break;
            default:
                break;
        }
        drpSelAction.SelectedIndex = 0;
    }

So before this kicks off - i need to get a confirmation dialog to come up.

Any help would be appreciated.

Thanks.

GREG LANDGRAF
APPLICATION EXPERT
Computerized Facility Integration (CFI)
20 N Wacker Drive, Suite 2600, Chicago, IL 60601
OFFICE:&nbsp;&nbsp;312.236.2323 x 6854
MOBILE: 847.721.3027
FAX:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;312.236.2336
EMAIL:&nbsp;&nbsp;&nbsp;glandgraf@gocfi.com
Facilities Technology - Better, Faster and Cheaper!
 
Old March 21st, 2005, 11:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Try adding javascript code. THere should be a change event (onchange or onchanged) that fires when the item changes, then you can add:

return confirm('Are you sure you want to do this?')

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird problem with dropdown onclick event in IE 7. tovipul21 Classic ASP Basics 1 September 7th, 2007 01:15 PM
replace Word dialog with my designing dialog doublelucky Visual C++ 0 March 19th, 2007 02:27 AM
Javascript Confirm dialog difficulty ayrton Javascript 1 May 20th, 2005 03:34 AM
server control event in modal dialog diyagp General .NET 0 August 26th, 2004 02:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.