Hi,
I do a VS.NET (Webform)radiobuttonlist with one dropdownlist and textbox.
If I pick
"1" then
"Enable dropdownlist" and "Disable textbox",
"2"
"Enable textbox" but "Disable dropdownlist"
This is my code:
<asp:RadioButtonList id="rbSelection" onclick="abc(this);" runat="server">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:RadioButtonList>
function abc(rad)
{
switch (rad.value){
case "1":
var e=document.getElementById("dropdownlist");
e.style.disabled =true;
var t=document.getElementById("textbox");
t.style.disabled ="false";
break;
case "2" :
var e=document.getElementById("dropdownlist");
e.style.disabled ="false";
var t=document.getElementById("textbox");
t.style.disabled ="true";
break;
}
}
I think the problem should be in <onclick="abc(this);">, Is anyone know do it?
Appreciate for any help.
Calvin
I do a VS.NET (Webform)radiobuttonlist with one dropdownlist and textbox.
If I pick
"1" then
"Enable dropdownlist" and "Disable textbox",
"2"
"Enable textbox" but "Disable dropdownlist"
This is my code:
<asp:RadioButtonList id="rbSelection" onclick="abc(this);" runat="server">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:RadioButtonList>
function abc(rad)
{
switch (rad.value){
case "1":
var e=document.getElementById("dropdownlist");
e.style.disabled =true;
var t=document.getElementById("textbox");
t.style.disabled ="false";
break;
case "2" :
var e=document.getElementById("dropdownlist");
e.style.disabled ="false";
var t=document.getElementById("textbox");
t.style.disabled ="true";
break;
}
}
I think the problem should be in <onclick="abc(this);">, Is anyone know do it?
Appreciate for any help.
Calvin