confirm popup box with YES,NO buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ani1
    New Member
    • Apr 2014
    • 1

    confirm popup box with YES,NO buttons

    In asp.net code behind page window.confirm method is used to display the confirm popup box with OK CANCEL buttons, on aspx button click based on some condition.

    But as per the requirement user want YES NO buttons in the confirm popup.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You cannot use server code to display popups in asp.net server-side code.

    You have to use the JavaScript confirm instead.

    You can prevent the button click event by returning True or False in the client-side onclick event.

    For example:
    Code:
    <asp:Button ID="DeleteItem" 
                runat="server" 
                UseSubmitBehavior="false"
                OnClientClick="return confirm('Are you sure you want to delete the item?');"
                OnClick="DeleteItem_Click" />
    From what I remember, you need to specify false for the Button.UseSubmi tBehavior Property to make this work.

    Note that the OnClientClick code allows you to provide JavaScript to execute during the JavaScript (client-side) onclick event so it executes the JavaScript code provided...whil e the OnClick event specifies the method to call once the server processes the .NET button click event.

    -Frinny

    Comment

    • ZeeshanAli
      New Member
      • Aug 2014
      • 3

      #3
      You can not change the title of the Confirm buttons.
      Ok , Cancel to Yes , No. you would have to make a custom popup having Yes Or No button.

      Comment

      Working...