asp.net的DropDownList如何后台设置默认值
菜鸟狂飞 2011-10-20 04:32:36 DropDownList1.Text = "男";
这样可以设置,
但是,读取数据库这样
DropDownList1.Text = read["Sex"].ToString();
就不能设置了。
这样
string str = read["Sex"].ToString();
DropDownList1.Text = str;
也不可以。
为什么啊?
我
Response.Write(str);
是有东西的。
这个如何解决,先谢过了