如何在绑定后添加两个项目到下拉列表。 [英] how to add two more items to dropdown after binding .
本文介绍了如何在绑定后添加两个项目到下拉列表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
drpBusinessUnit.Items。插入( 0 ,新的ListItem( , 0\" 跨度>));
drpBusinessUnit.Items。 Insert ( - 1,new ListItem( - All - , - 1)) ;
这是我试图在绑定后添加的内容fropdown ..我想在下拉列表中添加两个项目...在0索引时没问题,但我想在0索引上面添加一个项目,值对我很重要..
解决方案
drpBusinessUnit.Items。插入( 0 ,新的ListItem( , 0));
drpBusinessUnit.Items。插入( 0 ,新的ListItem( - 全部 - , 0));
设为0(零)在零指数中添加一个项目后,它将工作bcause,当你添加第二个项目时,第一个将成为1
尝试它。
接受它,如果它为你工作
drpBusinessUnit.Items.Insert(-1,new ListItem( - All-) - , - 1));
检查此行是否已通过无效索引
drpBusinessUnit.Items.Insert(0, new ListItem("", "0"));
drpBusinessUnit.Items.Insert(-1, new ListItem("--All--", "-1"));
This is what i am trying to add after binding of fropdown .. i wanted to add two more items to the dropdown ... at 0 index its no problem , but i want one more item to be added above the 0 index , value is important for me ..
解决方案
drpBusinessUnit.Items.Insert(0, new ListItem("", "0")); drpBusinessUnit.Items.Insert(0, new ListItem("--All--", "0"));
Make it 0(zero) in both it will work bcause after adding one item at zero index and when you add second item the first will become 1
try it.
Accept it if its work for you
drpBusinessUnit.Items.Insert(-1, new ListItem("--All--", "-1"));
check this line you have passed the invalid index
这篇关于如何在绑定后添加两个项目到下拉列表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文