asp.net:如何从下拉列表中删除项目? [英] asp.net: How can I remove an item from a dropdownlist?
本文介绍了asp.net:如何从下拉列表中删除项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个下拉列表,在某些情况下需要删除一个项目(在代码隐藏中).我需要根据项目的价值删除项目.
I have a dropdownlist, and in some cases need to remove an item (in the code-behind). I need to remove the item based on the value of the item.
我该怎么做?
推荐答案
你可以使用这个:
myDropDown.Items.Remove(myDropDown.Items.FindByValue("TextToFind"));
这篇关于asp.net:如何从下拉列表中删除项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文