我的问题很简单:
我想在DropDownList的SelectedIndexChanged事件中比较DropDownList当前选择的值和一个字符串常量,如果相等再继续下去,但是知道该用它的那个成员函数,试了好久都不行,郁闷。我的代码:
private void DropDownListlei_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.DropDownListlei.SelectedItem.Text=“化学元素”
Response.Write("<script>“化学元素”)</script>");
}
但是这样写老是报错:
c:\inetpub\wwwroot\MaterialDB\chuji.aspx.cs(63): 无法将类型“string”隐式转换为“bool”
我想在DropDownList的SelectedIndexChanged事件中比较DropDownList当前选择的值和一个字符串常量,如果相等再继续下去,但是知道该用它的那个成员函数,试了好久都不行,郁闷。我的代码:
private void DropDownListlei_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.DropDownListlei.SelectedItem.Text=“化学元素”
Response.Write("<script>“化学元素”)</script>");
}
但是这样写老是报错:
c:\inetpub\wwwroot\MaterialDB\chuji.aspx.cs(63): 无法将类型“string”隐式转换为“bool”
解决方案 »
- 把服务器空间的AutoPostBack属性设置为False如何取值
- Flv 文件怎么设置自动播放
- .NET教程
- vs2005中如何找到: Global.asax.cs
- 关于<%# %>的疑问,似乎<%# %>只能用来绑定数据,而不能进行运算
- asp.net高分求助:Object reference not set to an instance of an object
- Vs2005下,怎样动态修改asp.net2.0中的web.config文件中的主题!即用户如何动态修改页面显示方式的主题!服务端怎么操作?
- 一大早问大家一个SQL的问题!
- 为什么我写入的cookies和别人的不一样
- 求代码, DropDownList 绑定DATAGRID 当按下下拉框在下面弹出一个DATAGRID?谢谢
- Asp.net打开数据库的问题,莫名其妙的,大家来看看
- 如何判定CheckBoxList对象的第一个selected对象,C#实现
你那个=是赋值