zoukankan      html  css  js  c++  java
  • 'ddlXXX' has a SelectedIndex which is invalid because it does not exist in the list of items

    '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 information 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();

  • 相关阅读:
    PRTG安装
    如何诊断windows性能问题
    windows性能监控
    PAM 認 證 模 組
    RHEL磁盘修复
    RHEL下修改市区
    Recover database using backup controlfile until cancel
    Cancel-Based Recovery
    北京、上海的人口并不多
    swoole中http_server的配置与使用
  • 原文地址:https://www.cnblogs.com/emanlee/p/1669403.html
Copyright © 2011-2022 走看看