'ddlxXX' has a Selectedindex which is invalid because it does not exist in the list of items.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more @R_436_4045@ion about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: 'ddlxXX' has a Selectedindex which is invalid because it does not exist in the list of items.
Parameter name: value
Source Error:
Line 269: ddlxxx.DataTextField = "Name" Line 270: ddlxxx.DataValueField = "id" Line 271: ddlxxx.DataBind() Line 272: ddlxxx.Items.Insert(0, New ListItem("All", "-1")) Line 273: ddlStudents.Selectedindex = 0
============================
listOrgs.Items.Clear();
listOrgs.Selectedindex = -1;
listOrgs.SelectedValue = null;
listOrgs.ClearSelection(); // Clears the selection to avoid the exception (only one of these should be enough but in my application I needed all..)
listOrgs.DataSource = new Organization().DTListAll(SiteID);
listOrgs.DataTextField = "OrganizationName";
listOrgs.DataValueField = "OrganizationID";
listOrgs.DataBind();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。