Solved

Redirect after AJAX call

Posted on 2011-03-08
1
445 Views
Last Modified: 2012-05-11
Hi,

I have an ASP.NET web page which displays details of a job within an Infragistics WebTab which is AJAX enabled.

Within this tab is a delete button which when clicked will use an AJAX callback to call a delete function on the server.  This deletes the job from the back-end database.  What i want to do on return from the callback is to re-direct to another page.

How can I do this?  I am coding using C#.  I guess a relasted question would be that if I have a button which is within an AJAX container can I make the button perform a normal postback rather than an AJAX callback?
0
Comment
Question by:ChrisMDrew
1 Comment
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 500 total points
ID: 35074050

you can add "triggers" tag to your UpdatePanel and specify wich control must do a postback.
in page_load code behind, redirect page if certain condition is met (for example you can test hidden control value that you set before postback).

example :

aspx page :

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
   
      .......(page asp and html code, controls etc...)
     <asp:Button ID="MyButton" runat="server" CssClass="but" Height="32px" Text="Hello"  Width="74px" />
     <asp:Label ID="Test" runat="server" Visible="False"></asp:Label>
                                     

<Triggers>
            <asp:PostBackTrigger ControlID="myButton"  />
</Triggers>

</asp:UpdatePanel>


code behind :


 Protected Sub myButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyButton.Click

... do some stuff

test.text="postback send by mybutton"

end sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

If IsPostBack Then
  if test.text="postback send by mybutton" then
  reponse.redirect("anotherPage.aspx")
  end if
end if

Exit Sub







   
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question