Jump to content

OnClientClick problem


joecool2005

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...