When an ASP.NET server-side button is given client-side JavaScript code to execute when handling onclick, the button no longer posts back by default. However, there is a small piece of code you can add to the onclick attribute of the button to re-enable the postback behavior.
Adding this code in the Page_Load method will remove a server-side button's postback call:
btnConfirm.Attributes.Add("onclick", "Confirm_Click();")
But writing the code like this will reinstate the postback call:
btnConfirm.Attributes.Add("onclick", "Confirm_Click(); " + ClientScript.GetPostBackEventReference(btnConfirm, ""))
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment