conformation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganesh22
    Banned
    New Member
    • Sep 2007
    • 81

    conformation

    Hi,
    my requirement is while click the submit button i want to give the conformation that means "Plz check all fields r currect" if ok we can modifie there another button is proceed if i click that means then our asp.net code will be executed
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Add a javascript statement to the onclick event of your button (if you do it from the designer it's called onClientClick)

    I do this:
    Code:
    myButton.Attributes.Add("onclick", "return confirm('Are you sure all the fields are correct?')");
    The "return" portion is the key here. If a javascript statement says "return false" (which would happen if the user clicks cancel on the popup dialog) then nothing further is executed.
    So if they said no, nothing would happen and they could adjust the fields to be correct. If they say yes, then the page continues to do the postback or whatever else you had wanted to happen the button is clicked.

    Comment

    Working...