I'd like to disable a submit button to prevent mutiple database entries.
I've not had a problem disabling the button using Javascript but the method i used seems to intercept the postback and so the normal code is never executed. I found out i had to manually post the form, with this the form is submitted and page_load runs but i still can't get the button_onclick event to run after the button is disabled. code.....
I've found quite a few examples on the web but couldn't get any of them to work.VB Code:
'In code behind Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then btnSubmit.Attributes.Add("onclick", "return disableMe(this);") End If End Sub Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click 'Fairly long process here End Sub 'In Script in .aspx file <script language="javascript"> function disableMe(btn) { btn.disabled = true; document.form1.submit(); return true; } </script>
any ideas?




Reply With Quote