日期:2014-05-18  浏览次数:20553 次

请教Datagrid里面两个Dropdownlist连动!!!!
我在两个绑定列里分别放一个Dropdownlist
    Private   Sub   TMTDataGrid1_TMTableDataGridItemDataBound(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)   Handles   TMTDataGrid1.TMTableDataGridItemDataBound
              Dim   drd   As   DropDownList
            Dim   drdtwo   As   DropDownList
                Dim   tmtdg   As   TMTableDataGrid
                Dim   middle   As   Integer
                Dim   dt   As   DataTable
                Dim   j   As   Integer
            dt   =   New   DataTable
            tmtdg   =   Me.TMTDataGrid1.SubTMTableDataGrid
              dt   =   tmtdg.MaintenanceDataTable

            drd   =   CType(CType(e,   DataGridItemEventArgs).Item.Cells(3).Controls(1),   DropDownList)

                If   CType(e,   DataGridItemEventArgs).Item.ItemIndex   > =   0   Then
                        drd   =   CType(CType(e,   DataGridItemEventArgs).Item.Cells(4).Controls(1),   DropDownList)
                        drdtwo   =   CType(CType(e,   DataGridItemEventArgs).Item.Cells(5).Controls(1),   DropDownList)
                        middle   =   drdtwo.SelectedIndex
                        drd.SelectedIndex   =   middle

                End   If
end   sub
drdtwo.SelectedIndex总是取的上一次选的值,取不到当前的值


------解决方案--------------------
((DropDownList)item.FindControl( "DropDownList2 ")).SelectedIndex=DDL.SelectedIndex;

//这句