Link to home
Start Free TrialLog in
Avatar of scm0sml
scm0sml

asked on

hiding a listitem of my radiobuttonlist

I have the radio list below.

Basically based on a check inside an if statement i want to able to hide the fourth element, so the user would not see the "Uses Supplier Setup" option.

How can I go about doing that in the code behind?
<asp:radiobuttonlist id="rblAccountDueDate" runat="server" repeatdirection="horizontal">                       
                        <asp:ListItem value="1">Departure</asp:ListItem>
                        <asp:ListItem Value="2">Booking</asp:ListItem>
                        <asp:ListItem Value="3">Component Start Date</asp:ListItem>
                         <asp:ListItem value="0">Uses Supplier Setup</asp:ListItem>
                    </asp:radiobuttonlist>

Open in new window

Avatar of rohypnol
rohypnol
Flag of Romania image

Not sure but if I remember correctly, you should do this in the PageLoad event:
rblAccountDueDate.Items[4].Visible = false;
Avatar of scm0sml
scm0sml

ASKER

i get the intellisense to do this:
rblAccountDueDate.Items[4].Visible

but doesnt like me setting the value of false, i get:
Property access must assign to the property or use its value.
ASKER CERTIFIED SOLUTION
Avatar of scm0sml
scm0sml

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hint: Be careful, refresh the page a few times and make sure those items aren't added every time the page loads if it's an automatic reload caused by the ASP controls on the website (ie, if one of the controls has an event, asp will cause the page to reload automatically). You might end up with the list growing every time that happens.