execute javascript conditionally

  • Thread starter Thread starter cgia
  • Start date Start date
C

cgia

How to do the following?

When I click a button, it will check if a certain codition is
satisfied, in this case, and only in this one, I want the javascript
confirm to appear.

If I add this:

mybutton.Attributes.Add("onClick", "return confirm('Your Message');")

the popup will appear ALL the times I press the button.

Thanks
 
Hello (e-mail address removed),
When I click a button, it will check if a certain codition is
satisfied, in this case, and only in this one, I want the javascript
confirm to appear.
mybutton.Attributes.Add("onClick", "return confirm('Your Message');")

mybutton.Attributes.Add("onClick", "if (someClientSideLogicVariable) return confirm('Your Message'); else return true;");
 
Back
Top