Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: NET and JavaScript Not InSync


Message #1 by "J Donahue" <jdonahue@f...> on Fri, 7 Feb 2003 20:21:01
Hi.  I have a radiobuttonlist where the user can select which credit 
bureau to retrieve.  Since it retrieves the credit bureau from a web 
service, it takes several seconds to retrieve the data.  As a result, I 
put in a client side script that would change the radiobuttonlist to a 
message that says "Please Wait....". 
The problem is that I can click a bureau name (not the button itself) and 
the javascript recognizes the box as being clicked BUT NET does NOT.  So, 
my message is being changed by my javascript code but the server side 
routine is never being executed. 

The HTML is as follows: 
<div id="Radio" style="DISPLAY: inline"> 
<asp:label id="CBLabel" Runat="server">Select Bureau 
Source<br></asp:label> 
<asp:radiobuttonlist id="CBRadio" onclick="ChangeRadioDiv(this,true)" 
runat="server" AutoPostBack="True" 
OnSelectedIndexChanged="GetNewCreditBureau" RepeatDirection="Horizontal" 
RepeatLayout="Flow"> 
</asp:radiobuttonlist> 
</div> 
<div id="Message" style="DISPLAY: none"> 
<asp:label id="CBWorking" Runat="server" BackColor="#000000">Please 
Wait...<br></asp:label> 
</div> 

My Javascript is as follows: 

function ChangeRadioDiv(bMakeMsgViewable) {      
      if(bMakeMsgViewable == true) { 
            document.all.item("Radio").style.display = "none" 
            document.all.item("Message").style.display = "inline" 
      } 
      else { 
            document.all.item("Radio").style.display = "inline" 
            document.all.item("Message").style.display = "none" 
      } 
      return 
} 
The OnClick will execute and assume a radio button has been clicked but 
the OnSelectedIndexChanged doesn't consider a button as being clicked 
(because the user didn't click "exactly" within the button) and is never 
executed. 
How do I solve this?? 
Thanks!!! 

  Return to Index