下拉列表项添加 [英] Drop down list item add

查看:71
本文介绍了下拉列表项添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个下拉列表,其中填充了数据集中的数据,

现在我想添加测试 - 选择 - 在第一个地方,但同时我不想打扰从我的数据集到下拉列表的数据...

请帮助



感谢先前

解决方案

在数据绑定后添加以下代码:



 DropDownList1.Items.Insert( 0    - 选择 - ); 


根据您的要求,请尝试以下代码:



 DropDownList1.Items.Insert(0,new ListItem( -  Select  - ,12)); 


hello all,

I have a dropdownlist which is filled with data from dataset,
now i want to add test -- select -- on the first place, but at the same time i don''t want to disturb data which came from my dataset to dropdownlist...
please help

Thanks in Advance

解决方案

after databind add following code :

DropDownList1.Items.Insert(0, "--Select--");


As par your requirement, try below code :

DropDownList1.Items.Insert(0,new ListItem("--Select--","12"));


这篇关于下拉列表项添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆