两个下拉列表 [英] two drop down list

查看:108
本文介绍了两个下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的页面中,我有一个下拉列表(drpstatus)和列表
已分配
持有
等待中
在同一页面上,我有一个网格,在那个网格中,我有一个下拉菜单(drpaction)作为项目
具有相同列表的模板.
现在我想要如果我从drpstatus中选择任何值,例如holding,那么网格将向我显示与该值相关的记录
但我希望drpaction应该显示与选定值相同的值,即holding,等等.

in my page i have one drop(drpstatus) down with list
Assigned
holding
waiting
on same page i have one grid and in that grid i have one dropdown(drpaction) as a item
template with same list..
now i want if i select any value from drpstatus e.g.holding then grid shows me records related to that
but i want drpaction should show me same value as selected i.e.holding and so on

推荐答案



据我了解,您正在寻找ComboBox类的SelectedIndex属性.您可以做的是处理drpstatus的SelectedIndexChanged事件.在该事件处理程序中,您需要以下代码:

Hi,

From what I understand you are looking for the SelectedIndex property of the ComboBox class. What you can do is handle the SelectedIndexChanged event of the drpstatus. In that event handler, you need the following code:

private void drpstatusSelectedIndex_Changed(object sender, EventArgs e)
{
  // the combo box that raised the event
  ComboBox cb = (ComboBox)sender;

  drpaction.SelectedIndex = cb.SelectedIndex;
}



希望这是你的后援:)

戴夫



Hope this is what your after :)

Dave


这篇关于两个下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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