Hide/show panel onClick on item in radiobuttonlist

Hello.

I have a radiobuttonlist with two items.  if I check the last item I want to hide the panel with the label and textbox.  If I press the first item I want to show them again.
How can I do that.

<asp:RadioButtonList ID="rbl1" runat="server">
                <asp:ListItem Selected="True" Text="SomeText" Value="Value1">
                                       
                </asp:ListItem>
                <asp:ListItem Selected="False" Text="SomeOtherTex" Value="Value2" OnClick="pnlEntryMethod.Visible=False">
                   
                </asp:ListItem>
            </asp:RadioButtonList>
            <asp:Panel ID="pnlMyPanel" runat="server">
                <asp:Label ID="lblMyLabel" runat="server" Text="SomeText"></asp:Label>
                <asp:TextBox ID="tbSomeTextBox" runat="server"></asp:TextBox>
                </asp:Panel>


            </asp:Panel>
pucko73Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pucko73Author Commented:
I can also tell the the panel is  located inside a formview
0
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
hi..

On the RadioButtonList, set the AutoPostBack attribute to true.
0
pucko73Author Commented:
I need to do some more? Right?
I'm new to this.
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Julian HansenCommented:
You can do this with JQuery

Add this script to your page
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
var id = '<%= rbl1.ClientId %>_0';
$(function() {
    var i = 0
    
    $('#<%= rbl1.ClientId %> :radio').click(function(){
        if ($(this).attr('id') != id) {
            $('#<%= pnlMyPanel.ClientId%>').toggle();
            id = $(this).attr('id');
        }
    });
});
</script>

Open in new window

As you are selecting the first item by default you will need to initially hide your panel.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pucko73Author Commented:
thanks
0
Julian HansenCommented:
You are welcome - thanks for the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.