Source Code

for file /controls/ViewPage.js

// ViewPage.js
// Javascript Behaviour for the ViewPage Control
// Copyright (c) by Matthias Hertel, http://www.mathertel.de
// This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx
// -----
// 24.08.2005 created by Matthias Hertel.
// 19.11.2007 using the OpenAjax hub instead of PageProperties
// 18.12.2007 Simplifications and documentation.

jcl.ViewPageBehaviour = {
  view: "*",
  eventname: "view", /// <summary>The local or complete event name that is used for publishing OpenAjax events.</summary>

  init: function () {
    if (this.eventname != null) {
      this.eventname = jcl.BuildFullEventname(this);
      OpenAjax.hub.subscribe(this.eventname, this._handleEvent, this);
    } // if
  }, // init

  _handleEvent: function (eventName, eventData) {
    this.style.display = ((eventData == this.view) || (eventData == "*") ? "" : "none");
  } // _handleEvent

}; // jcl.ViewPageBehaviour

This page is part of the http://www.mathertel.de/ web site.

For updates and discussions see http://ajaxaspects.blogspot.com/.