Private Sub dgCommunion_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgCommunion.EditCommand
Dim selectValue As Int32 = Int32.Parse(dgCommunion.Items(e.Item.ItemIndex).Cells(2).Text)
dgCommunion.EditItemIndex = e.Item.ItemIndex
BindData()
Dim txt As TextBox
drop = dgCommunion.Items(e.Item.ItemIndex).Cells(4).FindControl("DropDownList1")
txt = dgCommunion.Items(e.Item.ItemIndex).Cells(5).FindControl("TextBox1")
Dim sourceRead As New Sources
drop.DataSource = sourceRead.LoadSource()
drop.DataTextField = "数据来源名称"
drop.DataValueField = "数据来源编号"
drop.DataBind()
drop.SelectedValue = selectValue
If drop.SelectedValue = 1 Then
txt.Enabled = True
End If
AddHandler drop.SelectedIndexChanged, AddressOf DropSelectedChanged
End Sub
上面是我在EditCommand中的代码。我也是在绑定后,用了AddHandler drop.SelectedIndexChanged, AddressOf DropSelectedChanged好像不行。没有响应DropSelectedChanged方法