Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.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
为什么我的警报没有弹出?Asp.NETC#_C#_Javascript_Asp.net_Alert - Fatal编程技术网

为什么我的警报没有弹出?Asp.NETC#

为什么我的警报没有弹出?Asp.NETC#,c#,javascript,asp.net,alert,C#,Javascript,Asp.net,Alert,我的警报没有弹出。当我用断点调试时,这一行被执行 Response.Write("<script>alert('" + " We don't seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>"); Response.Write(“警报”(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.a

我的警报没有弹出。当我用断点调试时,这一行被执行

Response.Write("<script>alert('" + " We don't seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>");
Response.Write(“警报”(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.aspx');
需要转义

这可以通过以下方式完成:

Response.Write("<script>alert('" + " We don\\'t seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>");
Response.Write(“警报(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.aspx');
它现在应该会弹出。

需要转义

这可以通过以下方式完成:

Response.Write("<script>alert('" + " We don\\'t seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>");
Response.Write(“警报(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.aspx');
它现在应该会弹出。

需要转义

这可以通过以下方式完成:

Response.Write("<script>alert('" + " We don\\'t seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>");
Response.Write(“警报(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.aspx');
它现在应该会弹出。

需要转义

这可以通过以下方式完成:

Response.Write("<script>alert('" + " We don\\'t seem to have this user registered. Please try again " + "') ; location.href='Login.aspx'</script>");
Response.Write(“警报(“+”我们似乎没有注册此用户。请重试“+”);location.href='Login.aspx');

它现在应该会弹出。

请参阅下面的代码示例以获取警报:

代码隐藏:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}
JavaScript:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}

有关更多信息,请参见下面的代码示例以获取警报:

代码隐藏:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}
JavaScript:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}

有关更多信息,请参见下面的代码示例以获取警报:

代码隐藏:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}
JavaScript:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}

有关更多信息,请参见下面的代码示例以获取警报:

代码隐藏:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}
JavaScript:

protected void Page_Load(object sender, EventArgs e)
{
    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "abc", "abc();", true);
}
function abc(message) {
    alert(message + ", I am an alert box!");
}

查看了解更多信息,您也可以尝试此功能

 System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your Message.');", true);

你也可以试试这个

 System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your Message.');", true);

你也可以试试这个

 System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your Message.');", true);

你也可以试试这个

 System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your Message.');", true);