Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » General » Downloads
 
Add your own
alternative version

Context Sensitive Help using Client Callbacks - AJAX Style

, 25 Sep 2006
This article is all about providing Context Sensitive Help in a web page, asynchronously or AJAX style, using Client Callbacks in .NET 2.0.
contextsensitivehelp_src.zip
ContextSensitiveHelpCode
ContextSensitiveHelp_src
ContextSensitiveHelp
App_Code
App_Themes
ControlsTheme
ContextSensitiveHelp.skin
CSS
Database
SampleDataBase.mdb
IMG
ContextSensitiveHelp.gif
Scripts
UserControls
Xml
Messages.dtd
/*
 * Cache Management Class
 * ==============================================================
 * Creator 			Ch.V.L.Mahendra
 * Created			17-Sep-2006
 * Environments		IIS 5.*, IIS 6.0, .Net Framework 2.0
 * Description 
 *
 * Responsible for managing the application cache. If cache
 * elements need updating, this class fetches information to
 * populate them from the database or XML file as applicable.
 *
 * Change Log
 * ==============================================================
 * Version	Date		Author		    Changes
 * 0.1		17-Sep-2006	Ch.V.L.Mahendra	Created
 */

using System;
using System.Web.Caching;
using System.Collections;
using System.Xml;
using ContextSensitiveHelp.Pages.Xml;

namespace ContextSensitiveHelp.Pages.Common
{
    /// <summary>
    /// Manages the application cache, and populates it if neccessary.
    /// </summary>
    public class CacheManager
    {
        #region Private Variables
        /// <summary>
        /// The cache object to hold the data.
        /// </summary>
        private Cache objApplicationCache;
        /// <summary>
        /// Variable to hold the status of the data in the Cache.
        /// </summary>
        private bool blnRefreshed;

        #endregion 

        #region Properties

        /// <summary>
        /// Value indicating whether cache has been refreshed in this instance
        /// </summary>
        public bool IsRefreshed
        {
            get
            {
                return blnRefreshed;
            }
            set
            {
                blnRefreshed = value;
            }
        }

        #endregion 

        #region Private Methods
             
        #region Method to Refresh the Messages Xml

        /// <summary>
        /// Refreshes the application error messages into the application cache.
        /// </summary>
        private void RefreshMessages()
        {
            /* load the XML error file into memory */
            XmlDocument objDocument = new XmlDocument();
            objDocument.Load(XmlMessage.XmlFile);
            objApplicationCache.Insert("appMessages", objDocument, new CacheDependency(XmlMessage.XmlFile));
            this.IsRefreshed = true;
        }

        #endregion 

        #endregion

        #region Public Methods

        #region Constructor Logic

        /// <summary>
        /// Constructor for the cache manager, checks that the
        /// lookup table has been cached by the application.
        /// </summary>
        /// <param name="objCache">The application's cache object</param>
        public CacheManager(Cache objCache)
        {
            objApplicationCache = objCache;
            this.IsRefreshed = false;
        }

        #endregion 
        
                  
        #region Method to load the Messages Xml

        /// <summary>
        /// Load the application help messages from the cache
        /// </summary>
        public void LoadMessages()
        {
            if (objApplicationCache["appMessages"] == null)
                RefreshMessages();

            XmlMessage.Xml = (XmlDocument)objApplicationCache["appMessages"];
        }

        #endregion 
      
        #endregion

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Mahi2407
Web Developer
India India
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Sep 2006
Article Copyright 2006 by Mahi2407
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid