K
KA Kueh
Dear all,
I am trying to enable the radiobuttonlist which is initally disabled via
javascript and could not get it to work. But if the radiobuttonlist is not
disabled initially then the javascript will work. Is this a feature by
design? What is the best way around this issue? Thanks.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestForm1.aspx.cs"
Inherits="TestForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function test()
{
if (document.getElementById('RadioButtonList1_0').checked)
document.getElementById('RadioButtonXX').disabled=false;
else
document.getElementById('RadioButtonXX').disabled=true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<div>
<asp:button ID="btnDelete" runat="server" onClientClick="return confirm('Are
you sure you want to delete this mailbox?')" Text="Delete" />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" >
<asp:ListItem>Apple</asp:ListItem>
<asp:ListItem>Orange</asp:ListItem>
</asp:RadioButtonList>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="test"
ControlToValidate="RadioButtonList1">
</asp:CustomValidator>
<aspropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="One" Value="1"></asp:ListItem>
<asp:ListItem Text="Two" Value="2"></asp:ListItem>
</aspropDownList>
<asp:RadioButtonList ID="RadioButtonXX" Enabled="false" runat="server" >
<asp:ListItem>Car</asp:ListItem>
<asp:ListItem>Lorry</asp:ListItem>
</asp:RadioButtonList >
</div>
</form>
</body>
</html>
I am trying to enable the radiobuttonlist which is initally disabled via
javascript and could not get it to work. But if the radiobuttonlist is not
disabled initially then the javascript will work. Is this a feature by
design? What is the best way around this issue? Thanks.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestForm1.aspx.cs"
Inherits="TestForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function test()
{
if (document.getElementById('RadioButtonList1_0').checked)
document.getElementById('RadioButtonXX').disabled=false;
else
document.getElementById('RadioButtonXX').disabled=true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<div>
<asp:button ID="btnDelete" runat="server" onClientClick="return confirm('Are
you sure you want to delete this mailbox?')" Text="Delete" />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" >
<asp:ListItem>Apple</asp:ListItem>
<asp:ListItem>Orange</asp:ListItem>
</asp:RadioButtonList>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="test"
ControlToValidate="RadioButtonList1">
</asp:CustomValidator>
<aspropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="One" Value="1"></asp:ListItem>
<asp:ListItem Text="Two" Value="2"></asp:ListItem>
</aspropDownList>
<asp:RadioButtonList ID="RadioButtonXX" Enabled="false" runat="server" >
<asp:ListItem>Car</asp:ListItem>
<asp:ListItem>Lorry</asp:ListItem>
</asp:RadioButtonList >
</div>
</form>
</body>
</html>