在单选按钮选择上显示Div标签 [英] Show Div tag on Radiobutton Selection

查看:71
本文介绍了在单选按钮选择上显示Div标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的查询是我的aspx页面中有两个单选按钮和两个div标签.

我想当我单击一个单选按钮时显示div1并隐藏div2,反之亦然,即当我单击另一个单选按钮时显示div2并隐藏div1.

请帮我

谢谢您.

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.

推荐答案

您可以轻松地在SelectedIndexChanged事件中添加逻辑,例如RadioButtonList like.

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

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;
            }

        }


这篇关于在单选按钮选择上显示Div标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆