Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.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#donds';行不通_C#_Javascript_Asp.net - Fatal编程技术网

带有c#donds';行不通

带有c#donds';行不通,c#,javascript,asp.net,C#,Javascript,Asp.net,LoadClientScriptMessage函数在Response.Redirect(“SamePage.aspx”)时不工作运行良好 if (command2.ExecuteNonQuery() == 0) { LoadClientScriptMessage("Something went wrong!"); } else { LoadClientScriptMessage("It is OK!"); Response.Redirect("SamePage.as

LoadClientScriptMessage
函数在
Response.Redirect(“SamePage.aspx”)时不工作运行良好

if (command2.ExecuteNonQuery() == 0)
{
     LoadClientScriptMessage("Something went wrong!");
}
else
{
     LoadClientScriptMessage("It is OK!");
     Response.Redirect("SamePage.aspx");
}
下面是
LoadClientScriptMessage
的实现:

private void LoadClientScriptMessage(string message)
{
    StringBuilder script = new StringBuilder();

    script.Append(@"<script language='javascript'>");
    script.Append(@"alert('" + message + "');");
    script.Append(@"</script>");

    Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script.ToString());
}
private void LoadClientScriptMessage(字符串消息)
{
StringBuilder脚本=新建StringBuilder();
script.Append(@“”);
附加(@“警报(“+”消息+“);”);
script.Append(@“”);
Page.ClientScript.RegisterStartupScript(this.GetType(),“Alert”,script.ToString());
}

您是否编写了
Ajax.Utility.RegisterTypeForAjax(typeof(Sample))页面加载?
和外接程序web.config

<system.web>

<httpHandlers>
 <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory,Ajax"/>

 </httpHandlers>
 </system.web>

您是否编写了
Ajax.Utility.RegisterTypeForAjax(typeof(Sample))页面加载?
和外接程序web.config

<system.web>

<httpHandlers>
 <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory,Ajax"/>

 </httpHandlers>
 </system.web>

您是否编写了
Ajax.Utility.RegisterTypeForAjax(typeof(Sample))页面加载?
和外接程序web.config

<system.web>

<httpHandlers>
 <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory,Ajax"/>

 </httpHandlers>
 </system.web>

您是否编写了
Ajax.Utility.RegisterTypeForAjax(typeof(Sample))页面加载?
和外接程序web.config

<system.web>

<httpHandlers>
 <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory,Ajax"/>

 </httpHandlers>
 </system.web>

响应。写入(“警报(‘警报消息’)”);
响应。写入(“警报(‘警报消息’)”);
响应。写入(“警报(‘警报消息’)”);
响应。写入(“警报(‘警报消息’)”);
当您调用
Response.Redirect(“SamePage.aspx”)
时 重定向当前请求,您将看不到任何响应 为当前请求呈现

你在这里得到的只是一个新的页面。如果仍要查看警报和重定向,请删除响应。使用javascript
window.location.href

 LoadClientScriptMessage("It is OK!");
 //Response.Redirect("SamePage.aspx");
  Page.ClientScript.RegisterStartupScript(this.GetType(), "redirct", 
  "window.location.href='somepage'",true);
当您调用
Response.Redirect(“SamePage.aspx”)
时 重定向当前请求,您将看不到任何响应 为当前请求呈现

你在这里得到的只是一个新的页面。如果仍要查看警报和重定向,请删除响应。使用javascript
window.location.href

 LoadClientScriptMessage("It is OK!");
 //Response.Redirect("SamePage.aspx");
  Page.ClientScript.RegisterStartupScript(this.GetType(), "redirct", 
  "window.location.href='somepage'",true);
当您调用
Response.Redirect(“SamePage.aspx”)
时 重定向当前请求,您将看不到任何响应 为当前请求呈现

你在这里得到的只是一个新的页面。如果仍要查看警报和重定向,请删除响应。使用javascript
window.location.href

 LoadClientScriptMessage("It is OK!");
 //Response.Redirect("SamePage.aspx");
  Page.ClientScript.RegisterStartupScript(this.GetType(), "redirct", 
  "window.location.href='somepage'",true);
当您调用
Response.Redirect(“SamePage.aspx”)
时 重定向当前请求,您将看不到任何响应 为当前请求呈现

你在这里得到的只是一个新的页面。如果仍要查看警报和重定向,请删除响应。使用javascript
window.location.href

 LoadClientScriptMessage("It is OK!");
 //Response.Redirect("SamePage.aspx");
  Page.ClientScript.RegisterStartupScript(this.GetType(), "redirct", 
  "window.location.href='somepage'",true);

您想显示警报并重定向用户,并抱怨它不起作用?还是当条件计算为true时,这是第一次调用?您想显示警报并重定向用户,并抱怨它不起作用?还是当条件计算为true时,这是第一次调用?您想显示警报并重定向用户,并抱怨它不起作用不起作用?或者它是条件求值为true时的第一个调用?您希望显示警报并重定向用户并抱怨它不起作用?或者它是条件求值为true时的第一个调用?