天天看点

DropdownList的SelectedIndexChanged事件的代码 - 张超的博客

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);
    }      
DropdownList的SelectedIndexChanged事件的代码 - 张超的博客