DropDownList取值问题 ddl.SelectedItem.Valueddl.SelectedItem.Text 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果某项被选中,对应的SelectedIndex就会有个值,你根据这个值就能取到。 不选择的情况下给定一个DataValueField的值找相应的DataTextField的值 DropDownList.FindByValue()DropDownList.FindByText() //TeamInfo 是 DropDownList int nCount = this.TeamInfo.Items.Count; for(int i = 0 ; i< nCount; i++) { if(TeamInfo.Items[i].Value == "Your Value") return TeamInfo.Items[i].Text; } return null; test = TeamInfo.Items.FindByValue("Your Value").Text; 问一个关于自动关闭MessageBox.Show的问题 急:Type如何转变为泛型T? c#中怎样将openfiledialog打开的文件显示在listbox中,以及直接显示出来? 请教:做NUnitASP测试时,用NUnit-GUI打开项目时老提示找不到文件或程序集名称"nunit.framework" VS2005 Winform使用水晶报表的项目如何打包? 报表程序中显示“无效的报表源”错误(散分) 这些数据是从哪来的 c# 面向过程 面向对象 该如何随机产生10组含有10位数字的数值 事件问题 web 页中的treeview问题? ADO.net是否有以前ADO中的分页显示功能?
给定一个DataValueField的值找相应的DataTextField的值
DropDownList.FindByText()
int nCount = this.TeamInfo.Items.Count;
for(int i = 0 ; i< nCount; i++)
{
if(TeamInfo.Items[i].Value == "Your Value")
return TeamInfo.Items[i].Text;
}
return null;