Disable buttons on post back using jquery in .net app

后端 未结 7 2018
悲哀的现实
悲哀的现实 2020-12-20 17:03

I have a asp.net app that I want to disable the buttons as soon as they are clicked in order to prevent multiple submissions. I\'d like to use jquery for this as the site a

相关标签:
7条回答
  • 2020-12-20 18:06

    Just another observation. Alternatively, you can lock UI with a nice overlay busy message.

    The Mark-up part:

    $(function() { // when document has loaded
    
        ($.unblockUI); //unlock UI
    
        //Show busy message on click event and disable UI
        $('#btnHelloWorld').click(function() {
        $.blockUI({ message: '<h4><img src="busy.gif" />Please wait...</h4>' });
    
        });
    
    });
    
    <asp:Button ID="btnHelloWorld" runat="server" Text="Hello World" /><br/>
    

    The Code behind:

       Protected Sub btnHelloWorld_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnHelloWorld.Click
            Label1.Text = "Hello World"
            Threading.Thread.Sleep(5000)
        End Sub
    

    Check out jQuery BlockUI Plugin

    0 讨论(0)
提交回复
热议问题