System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中
来源:互联网 发布:网络尖兵防御是什么 编辑:程序博客网 时间:2024/05/22 17:51
出现这个错误,居然是我绑定dropDownList1时绑错了字段,汗一下。下面是我百度到的,同样的错误,不同的原因。留下备用 。
异常详细信息: System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中。
最近在做用asp.net 2.0 开发,在将绑定数据到DropDownList。时抛出了一个很奇怪的异常。
异常详细信息: System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中。
或者在做下拉菜单连动时,让已知的值被选中,但列表的其它值也正常加载进来。用下面方法可解决,在此写下笔记:
只需这样赋值:
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("qqcrazyer"));
就是如果通过FindByValue没有找到指定项则为null,而Items.IndexOf(null)会返回-1.
- System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中
- C# B/S程序中使用DropDownList出现System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中的解决方法
- “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中。
- "DropDownList1“有一个无效 SelectedValue,因为它不在项目列表中。
- 有一个无效 SelectedValue,因为它不在项目列表中。
- 有一个无效 SelectedValue,因为它不在项目列表中。
- 有一个无效 SelectedValue,因为它不在项目列表中
- “DropDownList1”有一个无效 SelectedIndex,因为它不在项目列表中。
- “DropDownList2”有一个无效 SelectedValue,因为它不在项目列表中 问题的解决
- 解决 有一个无效 SelectedValue,因为它不在项目列表中
- 解决 有一个无效 SelectedValue,因为它不在项目列表中
- “Gender”有一个无效 SelectedValue,因为它不在项目列表中。参数名: value
- 解决 有一个无效 SelectedValue,因为它不在项目列
- 关于“DropDownList 有一个无效 SelectedValue,原因是它不存在于项目列表中”的解决办法
- “DropDownList1”有一个无效 S…
- DropDownList1.SelectedIndex及DropDownList1.SelectedValue的赋值
- 因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作的 <InsertFunction> 元素
- 因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有 支持当前操作的 <DeleteFunction> 元素
- Linux系统下安装 apache2.4的过程
- 大规模人脸识别算法及人脸属性分析算法
- 小故事大哲理
- linux下用华为H3C802.1x认证连接校园网
- 复杂背景下文字定位和识别算法
- System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中
- jsp页面如何获取服务器信息
- 在线自适应训练算法
- windows 下通过adb shell进入data目录,Permission denied 权限被拒绝
- Http Get & Post总结
- 一个简单的c程序,提取gem5运行benchmark产生的stats.txt中的l2cache的总不命中率
- VB APP对象属性一览表+灵活使用VB的APP对象
- linux中清除和导入到出历史命令
- android 开发感触