Click here to Skip to main content
13,835,376 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I would like to know how to use Server.Transfer or Response.Redirect from Ajax UpdatePanel?
Posted
Updated 19-May-10 5:21am
v3
Page 1 of 3

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 55

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:
   
Comments
m.gaber 3-Mar-11 3:56am
   
Yes , It's Work Now ..... Thank You
Member 2689865 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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I found it myself..
use javascript inside ur Updatepanel like the code below.
String TransferPage ;
TransferPage = "<script>window.open('Gallery-Page.aspx','_self');</script>";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "temp", TransferPage, false);
   
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 53

this will help..

http://www.codeproject.com/Questions/56736/How-to-use-Server-Transfer-from-Ajax-UpdatePanel.aspx
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 54

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.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 11

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,


<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.

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


Or you are looking for something else.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 56

</ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="YourButton" />
    </Triggers>
</asp:UpdatePanel>
   
Comments
CHill60 10-Apr-14 11:10am
   
4 years too late!
Wes Aday 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
Page 1 of 3
1 2 3

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190114.1 | Last Updated 10 Apr 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100