Click to See Complete Forum and Search --> : [RESOLVED] Enable = False not working
Bill Crawley
February 27th, 2007, 06:11 AM
Hi all,
I have an asp 2.0 page with a Button placed on the page.
Within the button_CLick event within the aspx.vb page the first thing I do is
mybutton.enabled = false
I then call my routine then I enable mybutton.
The routine is being entered, but mybutton is not disabling. on the aspx page, the button has been placed in a form element with method="post"
Fishdawg65
February 27th, 2007, 10:19 AM
don't you have to do a postback for the button to be disabled? If the method takes a while then maybe put it into a different thread. You should notice the disabling then.
Bill Crawley
February 27th, 2007, 11:05 AM
i've placed in the page load event on the server side:
btnCapture.Attributes.Add("onclick", "this.disabled=true;")
and behind the page itself I have:
<asp:Button ID="btnCapture" runat="server" Text="Generate Details" PostBackUrl="~/Default.aspx" />
Now when I press the button, my button disables, however it now does not run the process placed behind the btnCapture_Click event
Bill Crawley
February 28th, 2007, 10:28 AM
in the page load event I now have:
Dim cs As ClientScriptManager = Page.ClientScript
Dim sJavaScript As String = ""
sJavaScript = "if (typeof(Page_ClientValidate) == 'function') { "
sJavaScript += "if (Page_ClientValidate() == false) { return false; }} "
sJavaScript += "this.value = 'Please wait...';"
sJavaScript += "this.disabled = true;"
sJavaScript += cs.GetPostBackEventReference(btnCapture, "")
sJavaScript += ";"
btnCapture.Attributes.Add("onClick", sJavaScript)
and it works
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.