javascript disabled radiobutton doesn't get enabled in asp.net

  • Thread starter Thread starter Simon Brown
  • Start date Start date
S

Simon Brown

Hi,

here's the code, i have removed the irrelevent stuff

<HEAD>
<title>WebForm1</title>
<script language="javascript">
function DisableRadio()
{
document.Form1.RadioButton1.disabled = true;
}
</script>
</HEAD>
<body onload="DisableRadio()">
<asp:RadioButton id="RadioButton1" runat="server" Width="48px"
Height="42px"></asp:RadioButton>
</body>

I disable the button using DisableRadio() javascript function...
then i try to enable it using the following asp.net code

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
CheckBox1.Enabled = True
End Sub


it doesn't get enabled... why? Does the body_onload is called after
Page_Load??
what am i doing wrong?
 
Yes, your assumption is correct. The Private Sub Page_Load is called first
to create the html to stream to the client, then the browser runs the html,
which runs the body onload event.
 
Back
Top