Example of a custom bound field
namespace CustomControls
{
public class CompositeBoundField : BoundField
{
protected override object GetValue(Control controlContainer)
{
object item = DataBinder.GetDataItem(controlContainer);
return DataBinder.Eval(item, this.DataField);
}
}
public class CompositeCheckBoxField : CheckBoxField
{
protected override object GetValue(Control controlContainer)
{
/*bool isChecked = false;
if (this.DataField.ToLower() == "true")
isChecked = true;
object item = DataBinder.GetDataItem(controlContainer);
return isChecked;
*/
object item = DataBinder.GetDataItem(controlContainer);
return DataBinder.Eval(item, this.DataField);
}
}
}
And add this to the config
<pages>
<controls>
<add assembly="App_Code" namespace="CustomControls" tagPrefix="cc"/>
</controls>
</pages>
Then you use it in your ASP.NET page. Hope this helps.