c# - Button disable function after clicking on it -


I saved the button in about 150 pages, when I click on the user save button, then disable the button after click needed. So that users do not click on the save button.

  Protected Zero Button 1_Click (Object Sender, EventAgps E) {// Once the user clicks the button to save button Button 1. Enabled = "false"}  

Now I am doing this way, is there a better solution that can provide me here to improve coding, would be great.

Thanks

I think the best option to complete this is Javascript If you are using jQuery (which I can also start making enough recommendations) then you can put javascript in your masterpages, you need to find a way to make selector for your save buttons. Like this:

  $ (document) .ready (function () {$ ('. Savebutton'). Bind ("click", function (e) {$ (this) .attr ("Passive", "true"); returning; // is caused by running client-side scripts.});});  

In this example, I assume that all the saved buttons will have a CSS class ".save button", but you can find your own way to select the button.

Cheers!


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -