我的问题很简单:
我想在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”