Click here to Skip to main content
15,891,253 members
Articles / Web Development / IIS

Custom Membership, Role Providers, Website administration tool, and Role based access to individual files

Rate me:
Please Sign up or sign in to vote.
4.00/5 (11 votes)
12 Jul 2011CPOL5 min read 157.6K   11.4K   93  
Custom Membership and Role Providers, a website administration tool, and Role based access to individual files.
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;

/// <summary>
/// Summary description for CheckBoxListEx
/// </summary>
public class CheckBoxListEx : CheckBoxList
{
    [Themeable(false)]
    public string DataSelectedField
    {
        get
        {
            object o = this.ViewState["DataSelectedField"];
            return (o != null) ? (string)o : string.Empty;
        }
        set
        {
            this.ViewState["DataSelectedField"] = value;
            if (base.Initialized)
            {
                base.RequiresDataBinding = true;
            }
        }
    }

    protected override void PerformDataBinding(System.Collections.IEnumerable dataSource)
    {
        base.PerformDataBinding(dataSource);

        if (DataSelectedField.Length > 0)
        {
            foreach (object row in dataSource)
            {
                ListItem li = this.Items.FindByValue(DataBinder.GetPropertyValue(row, this.DataValueField, null));
                li.Selected = (bool)DataBinder.GetPropertyValue(row, this.DataSelectedField);
            }
        }
    }
}

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
Software Developer (Senior)
Singapore Singapore
I love programming, reading, and meditation. I like to explore management and productivity.

Comments and Discussions