我使用UpdatePanel和UpdateProgress。
Response.Redirect
和JavaScript redirect window
都没有与他们合作。
此代码正常运行:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<asp:Image ID="ImageWait" runat="server" ImageUrl="../images/wait.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="ButtonSave" runat="server" Text="Save"
OnClick="ButtonSave_Click" ValidationGroup="Valid1" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ButtonSave"
EventName="Click" />
</Triggers>
</asp:UpdatePanel>
不工作:
protected void ButtonSave_Click(object sender, EventArgs e)
{
// Saved here
Response.Redirect("../Main/Success.aspx");
}
也不起作用:
protected void ButtonSave_Click(object sender, EventArgs e)
{
// Saved here
Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect",
"location.href = '../Main/Success.aspx'", true);
}
我该如何解决这个问题?
答案 0 :(得分:0)
您可以使用ScriptManager
protected void redirector_Click(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, GetType(), "redirect",
"location.href = 'ListViewDemo.aspx';", true);
}