function hideOptions() { var list = document.getElementById('rbList'); list.getElementsByTagName('input')[0].nextSibling.style.display = 'none'; list.getElementsByTagName('input')[0].style.display = 'none'; }
That hides the first item. alternatively, you can also remove the child I guess.
swapnil_visp...
0 Points
4 Posts
radiobutton list item make visible true or false in javascript
Aug 30, 2010 03:31 PM|LINK
in my project i have used one radiobuttonlist according different user login , i want to make one of radiobuttonlist item visible true or false..
please help me to solve this issue.
thanks in advance.
sansan
All-Star
53942 Points
8147 Posts
Re: radiobutton list item make visible true or false in javascript
Aug 30, 2010 03:49 PM|LINK
There is no property to make a listItem invisible in code behind. You can do it with javascript by hiding the element.
That hides the first item. alternatively, you can also remove the child I guess.
swapnil_visp...
0 Points
4 Posts
Re: radiobutton list item make visible true or false in javascript
Sep 02, 2010 05:57 AM|LINK
hi sansan thanks for your help i tried this but it can not worked .
sansan
All-Star
53942 Points
8147 Posts
Re: radiobutton list item make visible true or false in javascript
Sep 02, 2010 06:18 AM|LINK
not sure how you tried that. This is the markup and it works fine for me.
code behind:
That hides the first item. you have to modify it to fit your requirement.
swapnil_visp...
0 Points
4 Posts
Re: radiobutton list item make visible true or false in javascript
Sep 02, 2010 06:58 AM|LINK
hi thanks for your help again i tried the snippets which you provided and found that at client side snippets is work fine ,
but when i checked for server side snippets it hide the radiobuttonlist item but not the text .
sansan
All-Star
53942 Points
8147 Posts
Re: radiobutton list item make visible true or false in javascript
Sep 02, 2010 07:06 AM|LINK
Can you pls explain what you are trying to achieve?
you can hide the ListItem/Option by making it invisible. What do you mean by hiding the text? Hiding the list item means hiding the text.
swapnil_visp...
0 Points
4 Posts
Re: radiobutton list item make visible true or false in javascript
Sep 02, 2010 07:22 AM|LINK
i want to make one listitem visible false at pageload , hiding the text means radiobutton list control have radiobutton with text .
when i run the application it hide the radiobutton only not it related text. means for your radiolist example not hide the one text .
your snippets for client side is working for me .
r_vaishnavi
Member
8 Points
32 Posts
Re: radiobutton list item make visible true or false in javascript
Nov 09, 2010 07:01 AM|LINK
Hi,
I am also facing the same issue. If you found the solution pls help me
komminen
Member
2 Points
1 Post
Re: radiobutton list item make visible true or false in javascript
Jan 14, 2013 03:28 PM|LINK
May its too late for me to answer, but list.getElementsByTagName('input')[0].nextSibling.style.display = 'none'; works for me.
Thanks a lot sasan.Its small thing but took me hours to find it.