如何在下拉列表中选择垂直值 [英] how to select a perticular value in dropdownlist
本文介绍了如何在下拉列表中选择垂直值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在下拉列表中选择垂直值
我有一个下拉列表,其中数据绑定表单数据库对象列表,默认情况下如何在下拉列表中选择3个索引值.
提前谢谢..
how to select a perticular value in dropdownlist
i have a dropdownlist in which data bind form database objectlist how to select 3 index value in dropdownlist by default..
thankx in advance..
推荐答案
尝试使用此代码来获取特定的索引值
Hi,
try this code to get particular index value
sd.Items [3].Value
将数据绑定到下拉列表后,所有Best
All the Best
写这行
after binding the data to dropdownlist
write this line
dropdownlist1.SelectedIndex="3";
示例:
DataTable sample = new DataTable();
ddlSample.datatextfield = "name" ;
ddlSample.datavaluefield = "id";
ddlSample.datasource = sample;
ddlSample.databind();
string id = ddlsample.selecteditem.value
;
这篇关于如何在下拉列表中选择垂直值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文