Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Clientscript.RegisterStartupScript未显示_C#_Asp.net - Fatal编程技术网

C# Clientscript.RegisterStartupScript未显示

C# Clientscript.RegisterStartupScript未显示,c#,asp.net,C#,Asp.net,我正在开发一个网站,试图通过ClientScript.RegisterStartUpScript显示消息 此项已成功显示: ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('All questions have been visited !');", true); 虽然它给出了一条带有复选框的消息,上面写着“阻止此页面创建其他对话框”。但我没有选中复选框。在我的代码隐藏中,我有以下条件: if (l

我正在开发一个网站,试图通过ClientScript.RegisterStartUpScript显示消息

此项已成功显示:

ClientScript.RegisterStartupScript(this.GetType(), "myalert", 
  "alert('All questions have been visited !');", true);
虽然它给出了一条带有复选框的消息,上面写着“阻止此页面创建其他对话框”。但我没有选中复选框。在我的代码隐藏中,我有以下条件:

if (lblUnConfirmedQuestions.Text=="0")
{
}
else
{
    ClientScript.RegisterStartupScript(this.GetType(), "msg", 
     "alert( 'Please attempt all the questions !')",true);         
}
这张照片本应在稍后展示,但没有出现

在互联网上,我发现有人建议删除ClientScript消息中的单引号,我删除了它们,但仍然没有成功。我应该如何显示第二条ClientScript消息?

“请尝试所有问题!”
只是文本

要显示警报消息,您需要类似的内容

ClientScript.RegisterStartupScript(this.GetType(), 
    "msg", "alert('Please attempt all the questions !');",true);    

为什么要使用RegisterStartupScript显示弹出窗口。相反,这应该用于加载泛型库,然后从代码中调用该库中的方法。对不起!这是我这边的一个编辑错误。我现在已经更正了。我实际上也使用了警报。@TVicky在if语句中设置了一个断点,并对其进行调试。除此之外,您的代码应该正常工作。如果您使用Ajax,请查看@TVicky您更新的代码运行良好。但是,如果其他代码中存在Javascript错误,上述代码也将停止工作。如何调试:创建一个没有母版页的ASPX页面,复制上面的代码,然后调试它。