填写下拉列表时出现问题 [英] problem in filling dropdown list
本文介绍了填写下拉列表时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi ..我正在使用以下代码手动填充dropdownlist,但是当我进入编辑模式时,条目r会翻倍.给我解决方法..
hi.. I am using following code for filling dropdownlist manualy, but when i comes in edit mode the entries r getting doubled. Give me solution..
ddlSponsershiptype.Items.Insert(0, new ListItem(0,new ListItem"-Select-"))
//ddlSponsershiptype.Items.Insert(1, new ListItem("LongTerm"));
//ddlSponsershiptype.Items.Insert(2, new ListItem("ShortTerm"));
推荐答案
尝试一下:
Try this:
ddlSponsershiptype.Items.Clear();
ddlSponsershiptype.Items.Insert(0, new ListItem("Select", string.Empty));
ddlSponsershiptype.Items.Insert(1, new ListItem("LongTerm", "LongTerm"));
ddlSponsershiptype.Items.Insert(2, new ListItem("ShortTerm", "ShortTerm"));
--Amit
--Amit
这篇关于填写下拉列表时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文