Solved

Call jquery fade in and out after Ajax

Posted on 2013-01-22
3
775 Views
Last Modified: 2013-01-23
Having $("document").Ready(function() {

$("body").bind("Ajaxcomplete")! Function(e,xhr,settings) {

$("#divshowmsg").fadein(100);
$("#divshowmsg").fadeout(100);

});
});

Is it possible to show the popup div message after asp.net ajax tag completed Ajax ?
If having two update panels, how to associate one to each?
0
Comment
Question by:doramail05
[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
3 Comments
 
LVL 3

Expert Comment

by:Khilu
ID: 38808811
Whenever an Ajax request completes, jQuery triggers the ajaxComplete event. Any and all handlers that have been registered with the .ajaxComplete() method are executed at this time.

http://api.jquery.com/ajaxComplete/
$(document).ajaxComplete(function(event, xhr, settings) {
$("#divshowmsg").fadein(100);
$("#divshowmsg").fadeout(100);
});

Open in new window


You can use "ajaxSuccess" event for sucess

http://api.jquery.com/ajaxSuccess/

$(document).ajaxSuccess(function() {

$("#divshowmsg").fadein(100);
$("#divshowmsg").fadeout(100);

});

Open in new window

0
 
LVL 1

Author Comment

by:doramail05
ID: 38808870
Ok, like what if I have 2 update panels and would prefer to show 2 different message one each?
0
 
LVL 22

Accepted Solution

by:
Mrunal earned 500 total points
ID: 38809575
Hi doramail05,
If you are using multiple Update Panels and if you want to do different functionality on updating on each update panel then you can below code...

with this code you can easily add your own code snippet whatever you want to do ...

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="KeepTimerOn_POC.TestPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        Outer Date Time:
        <%= DateTime.Now.ToLongTimeString() %>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                Date Time:
                <%= DateTime.Now.ToLongTimeString() %>
                <br />                
                <asp:Button ID="btnPostBack" runat="server" Text="Post Back" />
            </ContentTemplate>
        </asp:UpdatePanel><br /><br />
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                Date Time:
                <%= DateTime.Now.ToLongTimeString() %>                
                <br />
                <asp:Button ID="Button1" runat="server" Text="Post Back" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <script type="text/javascript" language="javascript">        
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(sender, e) {
            alert('start');
        });
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, e) {
            if (e._response._xmlHttpRequest.responseText.indexOf("|UpdatePanel1|") !== -1) {
                alert('Update panel 1 is updated ...');
            }
            if (e._response._xmlHttpRequest.responseText.indexOf("|UpdatePanel2|") !== -1) {
                alert('Update panel 2 is updated ...');
            }            
        });
    </script>
    </form>
</body>
</html>

Open in new window

0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
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…

627 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