如何禁用ASP.NET中下拉列表的第一项? [英] How Can i disable first item of my dropdown list in ASP.NET?
本文介绍了如何禁用ASP.NET中下拉列表的第一项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的下拉列表的顶部位置(即第一项)添加'select'。
就像 -
- 卖家 -
Item1
item2
item3
item4
所以我希望这个'选择'变为禁用,我该怎么做...请给我sggetions frnds?
i add 'select' at top position (i.e. as first item) of my dropdown list.
it's like-
--SELECT--
Item1
item2
item3
item4
so i want that this 'select' become disable, how can i do this...pls give me sggetions frnds?
推荐答案
你需要的确切答案在下面的链接
如何避免'请在下拉列表中选择'作为数据? [ ^ ]
The exact answer that you need is in the below link
how to avoid 'please select' in dropdown list to consider as data?[^]
在阅读项目时从下拉列表中,您添加以下条件,这种方式选项
- 选择 -
永远不会执行。
While you are reading items from dropdown, you add below condition, this way option
--Select--
never gets executed.
if (ddl.SelectedIndex != 0) // ddl being your dropdown
{
// add your code here.
}
或
你如果您选择的下拉列表索引为零(0),则可以禁用该按钮。
这假设你有一个使用下拉值的按钮点击事件。
OR
You can disable the button if selected index of your dropdown is zero (0).
This is assuming that you have a button click event which uses dropdown value.
使用jquery来禁用下面的下拉列表项目
Use jquery for Disabling the dropdown list items like below
这篇关于如何禁用ASP.NET中下拉列表的第一项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文