Jump to content

OnClientClick problem


joecool2005
 Share

Recommended Posts

Hi,On the following code, the button will be disabled after the user clicked by calling OnClientClick. But I have a problem. It does not execute Sub CommandBtn_Click. Plz help!Joe

<script runat="server">	  Sub CommandBtn_Click(sender As Object, e As CommandEventArgs) 		Message.Text = "this is a test"	End Sub</script>   <form id="form1" runat="server">	  <asp:Button id="Button1"		   Text="Sort Ascending"		   CommandName="Sort"		   CommandArgument="Ascending"		   OnCommand="CommandBtn_Click"		   OnClientClick="var oDiv = document.getElementById('Button1');oDiv.disabled=true;" 		   runat="server"/>		   	  <asp:Label id="Message" runat="server"/>   </form>

Link to comment
Share on other sites

Hi,On the following code, the button will be disabled after the user clicked by calling OnClientClick. But I have a problem. It does not execute Sub CommandBtn_Click. Plz help!Joe
Disabling the button in the client handler is preventing the server control click event from firing.Disable the button in Sub CommandBtn_Click instead:
Button1.Enabled = False

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...