Thursday, July 29, 2010

How to disable a button after click once ( avoid multiple submission of form data) - Asp.net

<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function disableButton(sender) {
            sender.disabled = "disabled";
            __doPostBack(sender.name, '');
        }
    </script>
    <script runat="server">        
        protected void Save(object sender, EventArgs e)
        {
 
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Button 
                runat="server" 
                ID="btnSave" 
                Text="Save" 
                OnClick="Save" 
                OnClientClick="disableButton(this)" 
                UseSubmitBehavior="false" />
        </div>
    </form>
</body>
</html>

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...