Frage

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?

War es hilfreich?

Lösung

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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top