Question

I have a page written in asp.net, in which I am calling Javascript alert message and it is not showing up, if I clear cache memory of browser then the alert message is showing up.

Can anybody tell the reason and solution?

Was it helpful?

Solution

Use onClientClick like this

 <asp:Button ID="btnSubmit" OnClick="btnSubmit_click()" OnClientClick="return check()"    
     runat="server"/>

  <script type="text/javascript">
    function check() {
       if (confirm('Are you sure you want to submit ?')) {
          // do further form validation here..  
          return true;

        }
        else {
            return false;
        }
    }
  </script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top