无法选择一个DropDownList多个项目 [英] Cannot select multiple items in a dropdownlist

查看:178
本文介绍了无法选择一个DropDownList多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C#ASP.NET网站上有一个奇怪的问题。

My C# ASP.NET web site has a weird problem.

我设置的基础上,从这样一个存储过程输出参数的值的dropdownlilst所选值:

I set a selected value for a dropdownlilst based on a value from a stored procedure output parameter like this:

this.myDropDown.SelectedValue = cmd.Parameters["@SourceID"].Value.ToString().Trim();

由于某种原因,我得到一个不能在DropDownList中选择多个项目的错误在这条线上code的。我已经通过了code踩,并寻找到这个DropDownList的其他引用,评论引用出来,又试了一次。

For some reason, I get a "Cannot have multiple items selected in a dropdownlist" error on this line of code. I've stepped through the code and searched for other references to this dropdownlist, commented the references out, and tried again.

不,仍然无法正常工作。

Nope, still doesn't work.

页面的工作的唯一方法是,如果我注释掉code以上线。任何想法,为什么这会是一个问题吗?

The only way the page works is if I comment out the above line of code. Any ideas why this would be a problem?

的SourceID总是整数并且存在于选择的列表。我已经验证(通过在code步进)的了selectedValue始终是数字,也绝不该行执行的时间和网页加载完成的时间之间变化。

SourceID is always an integer and exists in the list of selections. I've verified (by stepping through the code) that the selectedValue is always numeric, and never changes between the time this line executes and the time the page finishes loading.

思考?

推荐答案

这会如果您有相关的的DropDownList 两个项目会发生同样的

This would occur if you had two items in the DropDownList with the same Value.

这篇关于无法选择一个DropDownList多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆