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

Cascading Selection the MVC Way

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
29 Mar 2013CPOL12 min read 26K   509   25  
How to easily implement cascading selection the MVC way and leverage cached static data.
// Copyright (c) 2010-2012 Xomega.Net. All rights reserved.

using System.Web.UI.WebControls;

namespace Xomega.Framework.Web
{
    /// <summary>
    /// A class that provides data property binding for label web controls.
    /// It sets the editable text to the data property value formatted based on the EditString
    /// value format and keeps it in sync with the underlying property value.
    /// </summary>
    public class LabelPropertyBinding : WebPropertyBinding
    {
        /// <summary>
        ///  A static method to register the LabelPropertyBinding for Label web controls.
        /// </summary>
        public static void Register()
        {
            Register(typeof(Label), delegate(object obj)
            {
                Label lb = obj as Label;
                return IsBindable(lb) ? new LabelPropertyBinding(lb) : null;
            });
        }

        /// <summary>
        /// Constructs a new label property binding for the given label.
        /// </summary>
        /// <param name="label">The label to be bound to the property.</param>
        protected LabelPropertyBinding(Label label)
            : base(label)
        {
        }

        /// <summary>
        /// Do nothing on editability as the label is not editable.
        /// </summary>
        protected override void UpdateEditability()
        {
        }
    }
}

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
Architect Xomega.Net
United States United States
Xomega Team is striving to increase productivity and development quality by utilizing Model Driven Development coupled with Code Generation and the best design practices for application development.
We provide MDD tools, code generators and frameworks for Visual Studio and .Net development.
Visit us at http://www.xomega.net
This is a Organisation

1 members

Comments and Discussions