Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to know how to use Server.Transfer or Response.Redirect from Ajax UpdatePanel?
Posted
Updated 19-May-10 4:21am
v3

For Server.Transfer to work with UpdatePanel.

for getting update panel to post back.
we need to register post back contorl with the scriptmanager.

ScriptManager1.RegisterPostBackControl(button1);

and in this control you can do server.transfer.
:laugh:
 
Share this answer
 
Comments
m.gaber 3-Mar-11 3:56am    
Yes , It's Work Now ..... Thank You
[no name] 26-Jun-12 9:07am    
I have script manager in the Master Page . how do or where do i register the postback Url for the Button.

reply
Moni
I found it myself..
use javascript inside ur Updatepanel like the code below.
C#
String TransferPage ;
TransferPage = "<script>window.open('Gallery-Page.aspx','_self');</script>";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "temp", TransferPage, false);
 
Share this answer
 
v2
this will help..

http://www.codeproject.com/Questions/56736/How-to-use-Server-Transfer-from-Ajax-UpdatePanel.aspx
 
Share this answer
 
Hi,

I also has the same issue while using server.transfer with update panel.
When i m using this code:-

protected void Button1_Click(object sender, EventArgs e)
{
Server.Transfer("WebForm1.aspx");
}

It is giving script error.

Can you tell me why this is happening.
 
Share this answer
 
What is the issue with that ? If you have a control (say Button ) inside Update panel you can do redirection on that control click. As,


XML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
           <asp:Button ID="Button1" runat="server" Text="Button"
               onclick="Button1_Click" />
       </ContentTemplate>
   </asp:UpdatePanel>


And on button click you can do the redirection.

C#
protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("http://google.com");
    }


Or you are looking for something else.
 
Share this answer
 
XML
</ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="YourButton" />
    </Triggers>
</asp:UpdatePanel>
 
Share this answer
 
Comments
CHill60 10-Apr-14 11:10am    
4 years too late!
[no name] 10-Apr-14 11:14am    
There is really no reason to answer 4 year old questions that already have plenty of answers.
SoMad 11-Apr-14 1:19am    
Solution 56!!! I wonder what the heck happened here four years ago.

Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900