我一直收到上述错误,我已经尝试将下拉列表设置为新的下拉列表然后绑定,但之后会阻止任何绑定。我的代码:
Private Sub putStudentInstitutionList()
Dim strSql As String
Dim rtnSchoolData As DataSet
strSql = "SELECT schoolID, name FROM tSchool WHERE status = 1 ORDER BY name"
rtnSchoolData = cDB.executeReturn(strSql)
ddlInstitution.Items.Clear()
If rtnSchoolData.Tables(0).Rows.Count > 0 Then
ddlInstitution.AppendDataBoundItems = True
ddlInstitution.DataSource = rtnSchoolData.Tables(0)
ddlInstitution.DataTextField = "name"
ddlInstitution.DataValueField = "schoolID"
ddlInstitution.DataBind()
ddlInstitution.Items.Insert(0, New ListItem("", ""))
ddlInstitution.SelectedIndex = 0
ddlInstitution.Items.Insert(1, New ListItem("All Schools", "ALL"))
End If
End Sub
任何关于此的信息都将非常感激,问题发生在回发上,因为它试图重新绑定下拉列表。 在基于page.postback的条件下将其包装不起作用,因为下拉列表是在另一个下拉列表的基础上填充的,因此(实质上)绑定在回发上