Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.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.net 响应。重定向在更新面板中不工作_Asp.net_Updatepanel - Fatal编程技术网

Asp.net 响应。重定向在更新面板中不工作

Asp.net 响应。重定向在更新面板中不工作,asp.net,updatepanel,Asp.net,Updatepanel,我在客户端使用一个UdatePanel,在代码隐藏中使用response.redirect。但是由于updatepanel的原因,它不起作用。在使用updatepanel时有没有办法实现response.redirect。我在谷歌上看到了很多答案,但没有得到确切的答案 <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server"> <Pro

我在客户端使用一个UdatePanel,在代码隐藏中使用response.redirect。但是由于updatepanel的原因,它不起作用。在使用updatepanel时有没有办法实现response.redirect。我在谷歌上看到了很多答案,但没有得到确切的答案

  <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="loading">
            <div class="loader">
                <center>
        Please wait...<br />
        <img src="images/loadinfo.gif" alt="Loading..." />
      </center>
            </div>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

您可以使用
响应。重定向

protected void btnsubmit_Click(object sender, EventArgs e)
{
    Response.Redirect("Printsticker.aspx?itemId=" + hdApplication.Value);
}

根据我的测试,它适用于UpdatePanel中的按钮。我正在使用ASP.NET4.0,这可能会有所不同。作者提到他在较旧版本的框架中遇到了
Response.Redirect
和updatePanel问题。

您可以使用
Response.Redirect

protected void btnsubmit_Click(object sender, EventArgs e)
{
    Response.Redirect("Printsticker.aspx?itemId=" + hdApplication.Value);
}

根据我的测试,它适用于UpdatePanel中的按钮。我正在使用ASP.NET4.0,这可能会有所不同。作者提到,他在较旧版本的框架中遇到了
Response.Redirect
和updatePanel问题。

由于更新面板是通过AJAX调用更新的,所以无法真正执行服务器端重定向

但您可以通过客户端脚本更改位置:

ClientScript.RegisterStartupScript(this.GetType(), "scr", string.Format("location.href='Printsticker.aspx?itemId={0}';", hdApplication.Value), true);

由于更新面板是通过AJAX调用更新的,所以无法真正执行服务器端重定向

但您可以通过客户端脚本更改位置:

ClientScript.RegisterStartupScript(this.GetType(), "scr", string.Format("location.href='Printsticker.aspx?itemId={0}';", hdApplication.Value), true);

是否存在
响应.重定向
不起作用的特殊情况?当我尝试时,我没有发现任何问题(从UpdatePanel中按钮的事件处理程序中)。@ConnorsFan如果按钮触发UpdatePanel的部分回发-正常的页面生命周期没有发生,页面通过AJAX调用更新,因此响应。重定向将不起作用(尽管代码将编译并且不会抛出任何错误)是否存在
响应.重定向
不起作用的特殊情况?当我尝试时,我没有发现任何问题(从UpdatePanel中按钮的事件处理程序中)。@ConnorsFan如果按钮触发UpdatePanel的部分回发-正常的页面生命周期没有发生,页面通过AJAX调用更新,因此响应。重定向将不起作用(尽管代码将编译并且不会抛出任何错误)