CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2008
    Posts
    20

    Confirmation of delete for a drop down..

    Hello All,
    I have a problem in a project i am doing. Can any1 please help me in this.

    I have a drop down list as follows :

    Code:
    <asp:DropDownList  ID="PostActionDDL" runat="server" EnableViewState="false" OnSelectedIndexChanged="activeRegistrant_SelectedIndexChanged"
       AutoPostBack="true" >
                               <asp:ListItem Value="0">Select an Action</asp:ListItem>
                               <asp:ListItem Value="1">View</asp:ListItem>
                               <asp:ListItem Value="2">Delete</asp:ListItem>
           </asp:DropDownList>
    And i have the C# code as follows :
    Code:
     protected void activeRegistrant_SelectedIndexChanged(object sender, EventArgs e)
            {
               ///Some code..
                int selectedAction = Convert.ToInt32(dropList.SelectedValue);
    
                switch ((RegistrationActions)selectedAction)
                {
                    case RegistrationActions.View:
                        Response.Redirect("RegistrantDetails.aspx?id=" + registrationId.ToString());
                        break;
    
                    case RegistrationActions.Delete:
                        DeleteRegistration(registrationId);
                        //some code...
                        break;
                }
            }
    Now, everything here is fine and working. But now, if the user selects delete, the data is getting deleted correctly. But without any confirmation. So, if a user selects the delete in the drop down list, i want a pop up to ask " Are you sure you want to delete ?"
    And, if the user clicks view, i don't need any pop up.
    Can any1 please help me...

    Thanks
    Last edited by laptop545; June 22nd, 2010 at 10:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured