russomr
asked on
Disable radio button list item via asp.net code c#
I have the following radio list box:
<asp:RadioButtonList id="rdoPaymentPlan" runat="server" RepeatDirection="Horizonta l">
<asp:ListItem value="Fully Earned" id="lbEarned" selected="true">Fully Earned</asp:ListItem>
<asp:ListItem value="Annual" id="lb1" >Annual</asp:ListItem>
<asp:ListItem value="Semi Annual" id="lb2" >Semi Annual</asp:ListItem>
<asp:ListItem value="Quarterly" id="lb3" >Quarterly</asp:ListItem>
</asp:RadioButtonList>
How can I disable/enabel a specific list item via ASP.Net 1.1 C#? I can do it with javascript using:
lb1.disabled = false;
But how can I accomplish this via server-side?
<asp:RadioButtonList id="rdoPaymentPlan" runat="server" RepeatDirection="Horizonta
<asp:ListItem value="Fully Earned" id="lbEarned" selected="true">Fully Earned</asp:ListItem>
<asp:ListItem value="Annual" id="lb1" >Annual</asp:ListItem>
<asp:ListItem value="Semi Annual" id="lb2" >Semi Annual</asp:ListItem>
<asp:ListItem value="Quarterly" id="lb3" >Quarterly</asp:ListItem>
</asp:RadioButtonList>
How can I disable/enabel a specific list item via ASP.Net 1.1 C#? I can do it with javascript using:
lb1.disabled = false;
But how can I accomplish this via server-side?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cool. That is a good article. Thank you.
One last thing, the line: lbEarned.checked = true; does not work in the following code. I've tried .selected and that doesn't work either. Remember, this is a radio button list.
// enable payment plan if over 25,000
if(totalPremium >= 25000) {
lb1.disabled = false;
lb2.disabled = false;
lb3.disabled = false;
}else{
lbEarned.checked = true;
lb1.disabled = true;
lb2.disabled = true;
lb3.disabled = true;
}
I will award your points regardless since you did answer my post, however if you know why the above lbEarned.checked does not work, it would be much appreciated.
Thanks.
One last thing, the line: lbEarned.checked = true; does not work in the following code. I've tried .selected and that doesn't work either. Remember, this is a radio button list.
// enable payment plan if over 25,000
if(totalPremium >= 25000) {
lb1.disabled = false;
lb2.disabled = false;
lb3.disabled = false;
}else{
lbEarned.checked = true;
lb1.disabled = true;
lb2.disabled = true;
lb3.disabled = true;
}
I will award your points regardless since you did answer my post, however if you know why the above lbEarned.checked does not work, it would be much appreciated.
Thanks.
You're welcome.
I need more details regarding "lbEarned.checked does not work" in order to answer.
I need more details regarding "lbEarned.checked does not work" in order to answer.
ASKER
For the above code:
lbEarned.checked = true;
is the line that doesn't work. No error occur, but the radio button of lbEarned does not become the selected radio button.
lbEarned.checked = true;
is the line that doesn't work. No error occur, but the radio button of lbEarned does not become the selected radio button.
http://codeproject.com/aspnet/disableListItems.asp