Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My query is that I have two radiobutton and two div tags in my aspx page.

And I want when I clicked on one radiobutton then div1 is show and div2 is hide and vice versa i.e when click on other radiobutton then div2 is show and div1 is hide.

Pls help me out

Thanks in advanced.
Posted
Comments
Sunil.yadava09 18-Jan-11 6:40am    
I want this using javaScript

1 solution

Easily you can put a logic inside SelectedIndexChanged Event of RadioButtonList like.

C#
void rbl_SelectedIndexChanged(object sender, EventArgs e)
        {
if (rbl.SelectedItem.Text == "Show_Div_1")
            {
                Page.FindControl("div1").Visible = true;
                Page.FindControl("div2").Visible = false;
            }
            else
            {
                Page.FindControl("div2").Visible = true;
                Page.FindControl("div1").Visible = false;
            }

        }
 
Share this answer
 
Comments
Manfred Rudolf Bihy 19-Jan-11 16:08pm    
Corrected, a bit at least! 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900