As there is no real 'Response', methods like Response.Redirect and Response.Write will not work with atlas
You can try javascript redirect:
Page.ClientScript.RegisterStartupScript(this.GetType(),"redirect","location.href = 'SomePage.aspx'",true);
Although you are right while saying that Response.Write don't work for example in UpdatePanel, you are wrong when you say that Resonse.Redirect doesn't work. It works perfectly for me.
Check this:
<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
       
       
        <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Button runat="server" ID="Button1" Text = "Click me" OnClick="Button1_Click" />
            </ContentTemplate>
        </atlas:UpdatePanel>
    </form>
</body>
</html>
protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
When you say it works, what does that mean.
A Response.Redirect() works in that it does a response redirect on the callback. But I doubt that's what you would expect <s>... Most likely you'd want to redirect the full page not the callback.
It works because another page is displayed and the old one is "closed".
I don't understand why is this callback redirect a problem. Do you have some link so I can learn more about it?
Hello,
i had my testing login page like this and it returning error when i m redirecting to some page.
Login.aspx.vb
PartialClass login
Inherits System.Web.UI.Page
PrivateSub CheckLogin()
If txtLogin.Text ="admin"And txtPass.Text ="12345"Then
Session.Add("Login", txtLogin.Text)
Session.Add("Pass", txtPass.Text)
'Response.Redirect("default.aspx", True)
Else
Session.Add("Login", txtLogin.Text)
Session.Add("Pass", txtPass.Text)
'Response.Redirect("default2.aspx", True)
EndIf
EndSub
PrivateSub ClearFields()
txtLogin.Text =""
txtPass.Text =""
txtLogin.Focus()
EndSub
ProtectedSub btnLogin_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnLogin.Click
System.Threading.Thread.Sleep(500)
CheckLogin()
EndSub
ProtectedSub btnReset_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnReset.Click
System.Threading.Thread.Sleep(200)
ClearFields()
EndSub
EndClass
Login.aspx
<%@.PageLanguage="VB"AutoEventWireup="false"CodeFile="login.aspx.vb"Inherits="login" %>
<%@.RegisterAssembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Web.UI.Controls"TagPrefix="asp" %>
<%@.RegisterAssembly="Microsoft.Web.Preview"Namespace="Microsoft.Web.Preview.UI"
TagPrefix="asp" %>
<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajax" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
</head>
<body>
<formid="form1"runat="server">
<asp:ScriptManagerID="ScriptManager1"EnablePartialRendering="True"runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanelID="Panel1"runat="server"UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<tdstyle="width: 100px">
<asp:LabelID="lblLogin"runat="server"Text="Login :"></asp:Label></td>
<tdstyle="width: 100px">
<asp:TextBoxID="txtLogin"runat="server"></asp:TextBox></td>
</tr>
<tr>
<tdstyle="width: 100px">
<asp:LabelID="lblPassword"runat="server"Text="Password :"></asp:Label></td>
<tdstyle="width: 100px">
<asp:TextBoxID="txtPass"runat="server"TextMode="Password"></asp:TextBox></td>
</tr>
<tr>
<tdcolspan="2"style="height: 21px">
</td>
</tr>
<tr>
<tdcolspan="2">
<asp:ButtonID="btnLogin"runat="server"Text="Login"/>
<asp:ButtonID="btnReset"runat="server"Text="Reset"/></td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTriggerControlID="LinkButton1"EventName="Click"/>
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgressID="UpdateProgress1"AssociatedUpdatePanelID="Panel1"DisplayAfter="10"runat="server">
<ProgressTemplate>
<imgsrc="image/indicator.gif"/>
<br/>
loading..
<br/>
<imgsrc="image/indicator_mozilla_blu.gif"/>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:LinkButtonID="LinkButton1"runat="server">LinkButton</asp:LinkButton></div>
</form>
</body>
</html>
1) Response.Redirect is supported in atlas.
2) I tried the sample code you provided  without the assembliesMicrosoft.Web.Preview andAjaxControlToolkit
    and it worked fine for me. I have not tried by including the two mentioned assemblies.
vineetc
hmmm..i had posted my full code..act the main thing i wanna do is to hav the update progress run before redirecting to another page..
it is running well with the segment below :anyone know how to let the UpdateProgress appear before redirecting?
<Triggers>
<asp:PostBackTriggerControlID="btnLogin"/>
</Triggers>
anyone know how to let the UpdateProgress appear before redirecting? Thanks in advance
Response.Redirect work fine with properly configured AJAX extensions
Response.Redirect will not work without this in web.config.
           <httpModules>
               <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          </httpModules>
 
See this when we used Response.Write() with UpdatePanel
http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx
 
No comments:
Post a Comment