限制用户一次选择给定的下拉列表值 [英] Restricting the user to select a given dropdownlist value once
本文介绍了限制用户一次选择给定的下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我需要将列表中的某些项目绑定到下拉列表中.
完成此操作后,现在我想显示一个文本框,用户可以在该文本框中输入他从下拉列表中选择的值所对应的评论.
现在,在用户选择了特定的下拉列表值之后,我希望该值
不可编辑,因此用户不能在下拉列表中多次选择给定值.
如何限制用户一次选择给定的下拉列表值?
Hello,
I have a requirement in which I am binding some items from a list to a dropdownlist.
After I have accomplished this ,now I want to Display a textbox where a user can enter his comments as per the value selected by him from the dropdownlist.
Now after the user has selected the particular dropdownlist value I want that value to
be non editable so that the user cannot select a given value more than once in a dropdownlist.
How to restrict the user to select a given dropdownlist value once?
ddldropPPO.Items.Add(testdef.PPO1.ToString()); //Items fetched from a list
string PPO = ddldropPPO.SelectedItem.Text;
TextBox txtreason = new TextBox();
string reason = txtreason.Text;
推荐答案
最简单的方法是从集合中删除该值,并在用户选择该值后重新绑定.
The simplest way would be to remove the value from the collection and rebind after the user has selected that value.
这篇关于限制用户一次选择给定的下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文