to programmatically enable dropdown list element
i have 2 dropdown list dl9 and dl10 as given below....if i click yes from
dl9 dl10 is made visible....else it is hidden...now i want to make
selected value 'none' for dl10 when i click on 'no' and its goin to
database....if yes only 'completed' and 'ongoing' must b made
visible.....someone help me
<asp:DropDownList ID="DropDownList9" runat="server" Width="128px"
onchange="display()" >
<asp:ListItem Value="yes">Yes</asp:ListItem>
<asp:ListItem Value="no">No</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList10" runat="server" Width="107px"
TargetControlID="DropDownList9" >
<asp:ListItem Value="completed">Completed</asp:ListItem>
<asp:ListItem Value="ongoing">Ongoing</asp:ListItem>
<asp:ListItem Selected="True" Value="none"
Enabled="False">[SELECT]</asp:ListItem>
</asp:DropDownList>
my js to hide dl10 is:
<script type="text/javascript" language="javascript">
function display()
{
if (document.getElementById('<%=DropDownList9.ClientID%>').value
== "no")
{
document.getElementById('d1').style.visibility = "hidden";
document.getElementById('<%=DropDownList10.ClientID%>').style.visibility
= "hidden";
document.getElementById('<%=DropDownList10.ClientID%>').value
= "none";
//DropDownList10.SelectedValue = "none"; not wrkin
}
else {
document.getElementById('<%=DropDownList10.ClientID%>').style.visibility
= "visible";
document.getElementById('d1').style.visibility = "visible";
}
}
</script>
my problem here is...when i chick 'no' and submit 'completed' is goin into
database....but i need 'none' to be entered...somone help me plezzz
No comments:
Post a Comment