This is a migrated thread and some comments may be shown as answers.

Javascript Callback Confusion

2 Answers 74 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 May 2011, 08:32 AM
Hi,
I was looking at this project and could not understand a part of the javascript.
There is an asmx file in the project called Authentication. It has a method IsLoggedIn:

[ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Authentication : WebService
{
   [WebMethod]
    public bool IsLoggedIn()
    {
        return Context.User.Identity.IsAuthenticated;
    }
}

In the file ToolTip.aspx, that method is called as such:

<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
    <script type="text/javascript">
 
    function OnClientBeforeShow(sender, eventArgs)
    {
        Authentication.IsLoggedIn(successfulAuthCallback, failedAuthCallback, eventArgs);        
    }         
        
    function successfulAuthCallback(isLoggedInResult,eventArgs) {
 
        if (isLoggedInResult != true)           
        
            // reload the entire page so the Forms Auth will see that the cookie has expired and redirect to login
            window.location.reload(true);
        }        
    }
                  
    function failedAuthCallback(result, eventArgs)        
    {           
        alert("Auth Callback failed: Reason -- " + result);        
    }
    </script>
</telerik:RadCodeBlock>

My confusion stems from the fact that:
  1. IsLoggedIn has no formal parameters. However, it is being passed 3 parameters.
  2. I cannot see wheresuccessfulAuthCallback is being passed 2 parameters. It has two parameters. But where are they being passed to it.

Cheers

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 30 May 2011, 10:48 AM
Hello David,

 The callback functions you ask about are actually not passed across the wire, it's just "forwarded" on to the client side callback functions after the call completes. This is how things work in general and it is directly related to RadToolTipManager - more information is available in the net, e.g below:

http://geekswithblogs.net/bcaraway/archive/2007/06/02/112942.aspx

Best wishes,
Svetlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 31 May 2011, 09:25 AM
Thanks Svetlina.

That blog post did clear it up for me.
Tags
ToolTip
Asked by
David
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
David
Top achievements
Rank 1
Share this question
or