我设定DropDownList。selectedvalue时,无法触发indexchange事件

解决方案 »

  1.   

    要设置 DropDownList 的AutoPostBack 为True
      

  2.   

    AutoPostBack 是True,我在程序中根据用户在其他地方的输入设置DropDownList选定的值,并且触发change事件,这是我的设想,可是在手工选择时事件会触发,但在程序中指定值时,世间没反映,而且我在调用change事件时会出错,
      

  3.   

    if (!Page.IsPostBack)
    {
      加输入设置DropDownList选定的值;
    }
      

  4.   

    在你需要的地方:
    先设置DropDownList的值  通过value来设置SelectedIndex
    再调用DropDownList的dp1_SelectedIndexChanged(Nothing,Nothing)
      

  5.   

    this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);