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

  • 相关阅读:
    ALV 填值返回更新屏幕
    alv 的几种形式 和 函数
    JS 截取字符串的空格
    codeigniter 轻量级架构知识初习
    之前的博客挂掉了
    在服务器上运行php文件来执行操作
    浏览器判断
    php 汉字判断
    web 套打方法实现打印机功能
    WIN8
  • 原文地址:https://www.cnblogs.com/emanlee/p/1669403.html
Copyright © 2011-2022 走看看