|
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.
I love programming, reading, and meditation. I like to explore management and productivity.