How can I confirm and then disable a button in asp.net/javascript -


I have a standard ASP.NET 2.0 web page on which with a deleted button What I need and how to remove it can not be ascertained when the user gives a confirmation dialog popup to the delete button, which the user is "Are you sure?" If the user says yes then I want to disable the removal button and want to postback which will run server side code deleteButton_Click.

Here's the tag:

  & lt; ASP: Button ID = "Delete Button" text = "Delete" OnClick = "deleteButton_Click" runat = "server" />  

To click on the client side, javascript (in jquery) is:

  var deleteButton = $ (input.eq (0)); DeleteButton.click (function () {var a = Confirm ("Are you sure you want to delete this item?"); If (a == false) {return false;} else {deleteButton.attr ("disabled", "Disabled"); __do postback (delitaton ("id"), "");}});  

The confirmation dialog works and works as expected and works fine too. This form postback is fine but it does not run the DeleteButton_Click event handler. __do postback javascript code does not exist on the page

I can add UseSubmitBehavior = "false" to the DeleteButton tag, but then the confirmation dialog will ignore the reply.

So maybe I'm too much asking about ASP.Net.

"post-text"
  btnSubmit.Attributes.Add ("onclick", "If (Confirm (\" do you really want to delete this item? \ ") {This.disabled = true;" + ClientScript.GetPostBackEventReference "BtnSubmit," "). Ostring () +"} other {return false;} ");  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -