Click here to Skip to main content
15,881,712 members
Articles / Web Development / ASP.NET

Smum County Modal Form for ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.62/5 (15 votes)
17 Mar 2008CPOL7 min read 146.1K   1.7K   82  
Improvements on the ModalPopupExtender control provided as part of the ASP.NET AJAX Control Toolkit.
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AjaxControlToolkit
{
    /// <summary>
    /// Signifies that this method should be exposed as a client callback 
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
    public sealed class ExtenderControlMethodAttribute : Attribute
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification="Exposing this for user convenience")]
        private static ExtenderControlMethodAttribute Yes = new ExtenderControlMethodAttribute(true);
        private static ExtenderControlMethodAttribute No = new ExtenderControlMethodAttribute(false);
        private static ExtenderControlMethodAttribute Default = No;

        #region [ Fields ]

        private bool _isScriptMethod;

        #endregion

        #region [ Constructors ]

        /// <summary>
        /// Initializes a new ExtenderControlMethodAttribute
        /// </summary>
        public ExtenderControlMethodAttribute()
            : this(true)
        {
        }

        /// <summary>
        /// Initializes a new ExtenderControlMethodAttribute
        /// </summary>
        /// <param name="isScriptMethod"></param>
        public ExtenderControlMethodAttribute(bool isScriptMethod)
        {
            _isScriptMethod = isScriptMethod;
        }

        #endregion

        #region [ Properties ]

        /// <summary>
        /// Whether this is a valid ScriptMethod
        /// </summary>
        public bool IsScriptMethod
        {
            get { return _isScriptMethod; }
        }

        #endregion

        #region [ Methods ]

        /// <summary>
        /// Tests for object equality
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(obj, this))
            {
                return true;
            }
            ExtenderControlMethodAttribute other = obj as ExtenderControlMethodAttribute;
            if (other != null)
            {
                return other._isScriptMethod == _isScriptMethod;
            }
            return false;
        }

        /// <summary>
        /// Gets a hash code for this object
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return _isScriptMethod.GetHashCode();
        }

        /// <summary>
        /// Gets whether this is the default value for this attribute
        /// </summary>
        /// <returns></returns>
        public override bool IsDefaultAttribute()
        {
            return Equals(Default);
        }

        #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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
Lou has been a software developer for more than 16 years now mostly working on database applications. He is a big fan of the .NET environment.

Comments and Discussions