奇怪的
if (txtEmail.Text == " " || txtPwd.Text == " ")
{
Page.RegisterStartupScript( " ", " <script> alert(\ "用户名和密码不能为空!\ ") </script> ");
return;
}
弹出文本框正常
下面的怎么就不行了
if (DropDownListcounty5.SelectedValue == "0 ")
{
Page.RegisterStartupScript( " ", " <script> alert(\ "请选择区域!\ ") </script> ");
return;
}
------解决方案--------------------if (DropDownListcounty5.SelectedValue==null)
{
//code here
}
------解决方案--------------------public static void Show(System.Web.UI.Page page, string msg)
{
page.RegisterStartupScript( "message ", " <script language= 'javascript ' defer> alert( ' " + msg.ToString() + " '); </script> ");
}
函数调用 类名.Show(this, "提示内容 ");
------解决方案--------------------if(DropDownListcounty5.SelectedValue == "0 "&&DropDownListcounty5.SelectedValue==null)
{}
你先看一下,DropDownListcounty5.SelectedValue是什么值