![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
VS(C#)中,如何通过RadioButtonList_SelectedIndexChanged事件改变DropDownList中的内容
RadioButtonList下有A和B,现将DropDownList下的内容也分为a和b两组。如何通过A或B的选择使DropDownList下只显示a组数据或b组数据?...
RadioButtonList下有A和B,
现将DropDownList下的内容也分为a和b两组。
如何通过A或B的选择使DropDownList下只显示a组数据或b组数据?
怎样操作? 展开
现将DropDownList下的内容也分为a和b两组。
如何通过A或B的选择使DropDownList下只显示a组数据或b组数据?
怎样操作? 展开
2个回答
展开全部
把radiobuttonlist的autopostback属性设为true。
然后在事件中添加下面的代码就可以了!
{
DropDownList.DataSource = null;
if(RadioButtonList.SelectedIndex==0)
DropDownList.DataSource = a;
else
DropDownList.DataSource = b;
}
然后在事件中添加下面的代码就可以了!
{
DropDownList.DataSource = null;
if(RadioButtonList.SelectedIndex==0)
DropDownList.DataSource = a;
else
DropDownList.DataSource = b;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询