有一个表 课程表(课程编号,课程名称)
有两个下拉列表 DropDownList1 和DropDownList2 两个列表框都与课程表进行了绑定
其中DropDownList1 中显示的内容是课程编号,DropDownList2 中显示的课程名称,
现在我想让DropDownList2 中显示的内容随着DropDownList1中内容的变化而变化,该如何实现呢?请高手帮忙,C#语言

解决方案 »

  1.   

    双击DropDownList1 进入DropDownList1 的selectindexchange事件在此处获取DropDownList1 当前选中的编号根据编号绑定DropDownList2 
      

  2.   

    DropDownList2 这个不能自动绑定数据,你必须要后台代码控制,
    当DropDownList1 选中的值发生改变的时候,后台代码控制
    DropDownList2 的 Data Source 
      

  3.   

    selectindexchange 事件的具体代码该怎么编写呢?
      

  4.   

     Control _con= _gridView.Rows[e.RowIndex].Cells[i].Controls[1];
      

  5.   

    在DropDownList1 的selectindexchange事件里面
    根据DropDownList1选中的值从新帮定DropDownList2值
      

  6.   

    在DropDownList1 的selectindexchange事件中
               DropDownList2.selectedindex=DropDownList1.selectedindex;
      

  7.   

    第一步:绑定数据
    this.DropDownList1.DataTextField = "课程编号";
    this.DropDownList1.DataValueField = "课程名称";
    this.DropDownList2.DataTextField = "课程名称";
    this.DropDownList2.DataValueField = "课程编号";
    第二步:双击DropDownList1给DropDownList1添加DropDownList1_SelectedIndexChanged事件,记住要选择
    DropDownList1的AutoPostBack为true第三步:在事件里面写
    this.DropDownList2.SelectedValue = this.DropDownList1.SelectedItem.Text;
      

  8.   

    在DropDownList1 的selectindexchange事件里面
    string s = DropDownList1.text根据获取的s的值,然后去按照你想要的去获取DropDownList2的值,
    在DropDownList2绑定前,把DropDownList2清空。
    DropDownList2。clear();
      

  9.   

    http://topic.csdn.net/u/20100520/20/eb447ad3-6749-4dd9-945f-237dfad30f7b.html