static public String Titl;
现在使用简单的编程语言,假设我的窗体上有一个下拉列表。当我调试,我发现了一个id dropdownlist1是dropdowlist书面将从下拉列表中选择的值转换为字符串变量c#
dropdownlist1.text;
时包含了我在下拉菜单中选择的值。然而,当我做这样的事情:
titl = dropdownlist1.text;
我没有得到titl变量的值。需要帮助。谢谢!
static public String Titl;
现在使用简单的编程语言,假设我的窗体上有一个下拉列表。当我调试,我发现了一个id dropdownlist1是dropdowlist书面将从下拉列表中选择的值转换为字符串变量c#
dropdownlist1.text;
时包含了我在下拉菜单中选择的值。然而,当我做这样的事情:
titl = dropdownlist1.text;
我没有得到titl变量的值。需要帮助。谢谢!
检查这一点,如果你想text..then
title=dropdownlist1.selecteditem.text;
,如果你想要的值,然后
title=dropdownlist1.selecteditem.value;
Title = !string.IsNullorEmpty(dropdownlist1.SelectedItem.Text) ?
dropdownlist1.SelectedITem.Text : "";
Titl = dropdownlist1.SelectedValue;
作品!谢谢!
int selectedIndex=dropdownlist1.SelectedIndex;//get index
string selectedText=dropdownlist1.SelectedItem.Text;//get text
string selectedValue=dropdownlist1.SelectedItem.Value;//get value
Shree Khanal:那不会解决任何问题...... – Rupo 2012-08-03 07:46:31