DotNetNuke Client API - ClientCallback - .DotNetNuke Client API - ClientCallback Jon Henning

download DotNetNuke Client API - ClientCallback - .DotNetNuke Client API - ClientCallback Jon Henning

of 21

  • date post

    19-Jul-2018
  • Category

    Documents

  • view

    218
  • download

    0

Embed Size (px)

Transcript of DotNetNuke Client API - ClientCallback - .DotNetNuke Client API - ClientCallback Jon Henning

  • DotNetNuke Client API - ClientCallback

    Jon Henning

    Version 1.0.0

    Last Updated: September 2, 2005

    Category: DotNetNuke v3.2.0

  • DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    Information in this document, including URL and other Internet Web site references, is

    subject to change without notice. The entire risk of the use or the results of the use of

    this document remains with the user.

    The example companies, organizations, products, domain names, e-mail addresses,

    logos, people, places, and events depicted herein are fictitious. No association with any

    real company, organization, product, domain name, email address, logo, person,

    places, or events is intended or should be inferred.

    Complying with all applicable copyright laws is the responsibility of the user. Without

    limiting the rights under copyright, no part of this document may be reproduced,

    stored in or introduced into a retrieval system, or transmitted in any form or by any

    means (electronic, mechanical, photocopying, recording, or otherwise), or for any

    purpose, without the express written permission of Perpetual Motion Interactive

    Systems, Inc. Perpetual Motion Interactive Systems may have patents, patent

    applications, trademarks, copyrights, or other intellectual property rights covering

    subject matter in this document. Except as expressly provided in any written license

    agreement from Perpetual Motion, the furnishing of this document does not give you

    any license to these patents, trademarks, copyrights, or other intellectual property.

    Copyright 2005, Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    DotNetNuke and the DotNetNuke logo are either registered trademarks or

    trademarks of Perpetual Motion Interactive Systems, Inc. in the United States and/or

    other countries.

    The names of actual companies and products mentioned herein may be the trademarks

    of their respective owners.

  • DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    Abstract

    In order to clarify the intellectual property license granted with contributions of software from any person or entity (the "Contributor"), Perpetual Motion Interactive Systems Inc. must have a Contributor License Agreement on file that has been signed by the Contributor.

  • DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    Contents

    Introduction .....................................................................................................................1

    Goals.................................................................................................................................1

    Implementing Tomorrows Technology Today................................................................1

    What a Developer Needs To Do ...................................................................................... 2

    LifeCycle of a Client Callback.......................................................................................... 5

    Closing Thoughts............................................................................................................14

    Additional Information..................................................... 16

    Appendix A: Document History .........................................17

  • 1

    DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    It is a common practice to have client side

    script need to send data to the server.

    Within a web browser this is typically

    accomplished by either a POST or a GET.

    Both of these commands usually require a

    repainting of the page, since it is usually the

    form within the page that does the post, or

    the documents location being changed to

    do the GET. Over the years, there have

    been many attempts to improve the

    interaction between the client side code and

    the web server. Technologies like Remote

    Data Services (RDS), Remote Scripting,

    Javascript Remote Scripting (JSRS), and

    the Webservice Behavior were developed to

    address this interaction. RDS is outdated

    since it relies on COM and ActiveX.

    Remote Scripting was introduced and was

    quite successful since it utilized a Java

    Applet to initiate the request to the server.

    Unfortunately, Netscape decided to not

    support unsigned Java Applets starting

    with version 6, thus making it about as

    useful as an ActiveX control. Additionally,

    the JVM is no longer being included with

    the Windows platform. The Webservice

    behavior is a very cool way to have the

    client-side code interact with the server,

    however, since it relies on a behavior and

    the MSXML parser, it is an Internet

    Explorer only solution. That leaves JSRS,

    which works by creating a hidden IFRAME

    object on the page with a FORM embedded

    in it that can be posted to the server. This

    makes it the most widely accepted standard

    for the interaction, since it only requires the

    browser to support the IFRAME object and

    FORM elements.

    DotNetNuke Client API-ClientCallback

    Introduction

    The DotNetNuke Client API is composed of both

    server-side and client-side code that works

    together to enable a simple and reliable interface

    for the developer to provide a rich client-side

    experience. The ability to have client-side code

    communicate with the server without requiring a

    postback improves on this experience.

    Goals

    Provide a consistent means of communicating

    information between the client-side script and

    server-side code.

    Allow a broader range of browsers to support

    Client Callbacks than ASP.NET 2.0

    Enable Client Callbacks to work in ASP.NET 1.x

    Implementing Tomorrows Technology Today

    As evidenced by our implementation of the

    Provider model and Membership Provider, the

    DotNetNuke team demonstrated its commitment

    to continually move towards the latest standards

    that are pushed forth in the ASP.NET platform.

  • 2

    DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    Another enhancement that is to be offered by the next version of ASP.NET is Script

    Callbacks. While there have been many ways to accomplish this in the past (see sidebar),

    there really was not a standard way to implement the callback. For a detailed

    explanation of this new feature as it relates to ASP.NET 2.0 read the following articles.

    http://www.devx.com/dotnet/Article/20239/0/

    http://bitarray.co.uk/ben/articles/234.aspx

    The DotNetNuke Team decided to enhance the ClientAPI to support client Callbacks in

    ASP.NET 1.x. An additional requirement was to make this implementation support a

    broader range of browsers. In order to accomplish this, the reliance on the XmlHttp

    object needed to be abstracted. This is now handled in the new dnn.xmlhttp namespace

    on the client.

    A complete listing of the methods within this namespace along with their descriptions

    can be found in the DotNetNuke ClientAPI Namespace Browser.

    This document will outline the steps a developer needs to take to implement the Client

    Callback functionality, along with give a detailed look at what the ClientAPI is doing

    "under the covers".

    What a Developer Needs To Do

    If you read one of the links listed above the following steps should familiar to you.

    Step 1 - Implement the IClientAPICallbackEventHandler

    In order to handle a client callback your page or a control on the page must implement

    the IClientAPICallbackEventHandler interface.

    Public Class WebForm1 Inherits System.Web.UI.Page : Implements IClientAPICallbackEventHandler

    Step 2 - Obtain Javascript to Invoke CallBack

    This is done by calling the GetCallbackEventReference passing in the following

    parameters

  • 3

    DotNetNuke Client API - ClientCallback

    Copyright 2003-2005 Perpetual Motion Interactive Systems, Inc. All Rights Reserved.

    Argument Description

    objControl The control that is responsible for handling the

    callback. This control must implement the

    IClientAPICallbackEventHandler interface.

    strArgument This string is evaluated on the client-side and is

    passed to the server-side callback handler.

    strClientCallback The pointer to the client-side function that is to be

    invoked when callback is successful and complete.

    strContext This string is evaluated on the client-side and will be

    passed to the client side callback methods. For

    example, if you have multiple controls that can issue

    the same callback, when the method returns you need

    to distinguish which control caused the callback. This

    context variable allows you to pass the control

    reference to the

    strClientCallBack/strClientErrorCallBack

    function

    strErrorClientCallback The pointer to the client-side function that is to be

    invoked when callback errors out.

    Step 3 - Assign Callback Script to Javascrip