第一种方法
string str = DropDownList1.SelectedItem.Text;
第二种方法
if (DropDownList1.Items.FindByValue("value") != null)
{
string str = DropDownList1.Items.FindByValue("value").Text;
}
string str = DropDownList1.SelectedItem.Text;
第二种方法
if (DropDownList1.Items.FindByValue("value") != null)
{
string str = DropDownList1.Items.FindByValue("value").Text;
}
解决方案 »
- 点击展开或折叠TREEVIEW节点后,页面样式改变!
- frameSet里实现打印功能
- 感谢 mail_ricklee(NickLee)的帮助
- 从excel删除一行数据的sql
- TableItemStyle的HorizontalAlign属性在使用时系统提示does not contain a definition for 'HorizontalAlign'
- 求:Coalesys WebMenu for ASP.NET 2.1使用心得!!!
- 为何在类中引用Application变量会出现引用错误????
- 怎么扒取网站数据
- 奢求一域名跳转的问题,各位大虾,走过,路过,眼睛一定要溜过,谢了.
- 怎样在server 2008 R2 64位上共享文件夹(C# 代码实现)
- 现在用netadvantage开发的三层项目功能已经开发完成,遇到几个棘手的问题!在线等
- 请问如何让自定义控件大小随页面变化而变化?
DropDownList 显示列="name"
DropDownList 数据列="id"
string value="aaaa";
string output = "";
for (int i = 0; i < DropDownList1.Items.Count; i++)
{
if (DropDownList1.Items[i]. Value == value)
{
output = DropDownList1.Items[i].Text;
}
}