Total Pageviews

Wednesday 1 April 2015

Add javascript alert to asp.net button

Method: 1
-----------------
 <script> 
function alert_me() {
            return confirm('Hello!');
        }

 </script>

 <asp:Button ID="Button4"  OnClientClick="alert_me()"
                Text="Click Me" runat="server" />
            <br />



Method: 2
-----------------
<asp:Button ID="Button5"  OnClientClick="return confirm('are you sure?')"
                Text="Click Me" runat="server" />

No comments:

Post a Comment