Stop Postback on Button OnClientClick()

405 views Asked by At

I am facing an issue on disabling the button post back. I am trying to access the aspx page from outlook 2016 app

I have an asp.net aspx page I am creating a button dynamically and making post back false with btnSubmit.OnClientClick = "ValidateForm(); return false;"; in my local host. It works perfectly when I deploy to azure web app, but when I try to access the aspx page from outlook 2016 app (in outlook we have app when user click on this it loads some data and then it create some dynamic controls based on data) my problem is post back is not disabled.

1

There are 1 answers

0
AudioBubble On
btnSubmit.OnClientClick = "ValidateForm(event);"


function ValidateForm(event) 
{
  //your code
  event.preventDefault();
}

make sure javascript is enabled where this button is clicked