Solved

Redirect after AJAX call

Posted on 2011-03-08
1
459 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 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

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 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