Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirect after AJAX call

Posted on 2011-03-08
1
Medium Priority
?
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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