——此文章摘自《ASP
NET网络数据库开发实例精解》定价
¥
特价
¥
详细>>
// <summary>
// 设置控件的事件OnCheckChanged
// </summary>
private void OnCheckChanged(object sender EventArgs e)
{
if (CheckedChanged != null){CheckedChanged(sender e);}
}
// <summary>
//定义控件的属性Name
// </summary>
private string name;
public string Name
{
get{return(name);}
set{name = value;}
}
// <summary>
// 定义控件的属性DataField
// </summary>
private string dataField;
public string DataField
{
get{return dataField;}
set{dataField=value;}
}
// <summary>
// 定义控件的属性AutoPostback
// </summary>
private bool autoPostBack = false;
public bool AutoPostBack
{
set{autoPostBack = value;}
get{return autoPostBack;}
}
// <summary>
// 定义控件的数据绑定函数BindData()
// </summary>
private void BindData(object sender EventArgs e)
{
//找到CheckBox控件
CheckBox box = (CheckBox) sender;
DataGridItem container = (DataGridItem) boxNamingContainer;
boxChecked = false;
boxEnabled = (readOnly == true) ? false:true;
//获取数据
string data =
((DataRowView) containerDataItem)[dataField]ToString();
//获取数据类型
Type t = ((DataRowView)containerDataItem)DataViewTableColumns[
dataField]DataType;
if (dataLength>)
{
switch (tToString())
{ //设置控件的值
case SystemBoolean:
[] [] [] [] [] [] [] []