webForm中DropDowmList在点下拉列表的时候取出其中的值,而不是在提交页面的时候取出,如何实现?我想实现在DropDowmList在点下拉列表时候,另外一个列表连动!

解决方案 »

  1.   

    后台:
     void Page_Load()
    {
        if(Page.IsPostBack)
    {   下拉菜单的绑定
    }}

    private void sele1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        string a=sele1.SelectedItem.Value

                          连动另一个表:
               string Sql="select * from 表2 where  id="+Convert.ToInt32(a);.........
    }
      

  2.   

    写个函数啊,当dropdownlist1change的时候d2databind()啊
      

  3.   

    1.把第一个DropDownList的AutoPostBack属性设为true;
    2.在第一个DropDown的SelectedIndexChanged事件中重新绑定第二个DropDownList;
      

  4.   

    在服务器端实现会闪动很厉害。可以考虑用javascript在客户端实现。。