yueyue, I have fallen in love with you for

2011-02-09, 01:18:25 PM

DropdownList的SelectedIndexChanged事件的代码

Posted on 2011-11-16 15:17  张超的博客  阅读(329)  评论(0)    收藏  举报

 

 

DropdownList的Text属性读的是控件 的SelectedValue的值

实例: droisyckz.Text = dtl.Rows[0]["IsYcControl"].ToString().Trim();   从数据库中读出的是数字   显示在界面上的就是text的值

         很奇妙DropdownList没有value这个属性  

 

 

 

 

 

  protected void Dropjcxm_SelectedIndexChanged(object sender, EventArgs e)
{

if (Dropjcxm.SelectedValue == "1")
{
url = "<script language=javascript>";
url += "parent.parent.parent.bodyFrame.location.href='../jcsjgl/body.aspx'";

url += "</script>";

}
else if (Dropjcxm.SelectedValue == "2")
{

url = "<script language=javascript>";
url += "parent.parent.parent.bodyFrame.location.href='../jcsjgl_ws/body.aspx'";

url += "</script>";

}
else if (Dropjcxm.SelectedValue == "3")
{
url = "<script language=javascript>";
url += "parent.parent.parent.bodyFrame.location.href='../jcsjgl_hd/body.aspx'";

url += "</script>";

}
else if (Dropjcxm.SelectedValue == "4")
{

url = "<script language=javascript>";
url += "parent.parent.parent.bodyFrame.location.href='../jcsjgl_hk/body.aspx'";

url += "</script>";
}
else
{

throw new Exception("选择错误");
}
Response.Write(url);
}

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3