Solved

Redirect after AJAX call

Posted on 2011-03-08
1
417 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
Comment Utility

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Contant UI messages in .NET 1 40
401 - Error 6 24
Asp/Net Validation date Issue 9 36
What .NET website keeps me current? 9 28
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now