在2003中的AutopostBack在2005中无法使用啊.

解决方案 »

  1.   

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        If Not IsPostBack Then            Dim source As New System.Collections.Generic.List(Of String)
                source.Add("-1")
                source.Add("1")
                source.Add("2")            DropDownList1.DataSource = source
                DropDownList1.DataBind()            DropDownList2.DataSource = source
                DropDownList2.DataBind()        End If    End Sub    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
            If DropDownList1.SelectedValue = -1 Then
                DropDownList2.Enabled = False
            End If
        End Sub
      

  2.   

    把AutopostBack 设置为true
    然后在SelectedIndexChanged()事件里写用JS也可以
      

  3.   

    我就是这样处理的,但没有效果啊/
    AutopostBack 已经设置为true
     protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
           
            if (this.ddlType.SelectedIndex == 2)
            {
                this.ddlMonth.Enabled = true;
            }
            else
            {
                this.ddlMonth.Enabled = false;
            }
        }
      

  4.   

    在2003中这样可以实现的,但我现在在2005中就有问题了,高手们还能帮帮我啊 
    还有在2005中我怎么连下拉框中的选取的值也获不得,
    string deptTypeID = this.ddlType.SelectedValue;
    每次点添加按纽就重新加载,得到的值都是第一项