DataGrid中使用CheckBox的CheckedChanged事件
2005-09-07 13:52
411 查看
使用DataGrid的过程中常会用到CheckBox控件,并使用它的CheckedChanged事件。使用如下:
1、CheckBox控件需要设置AutoPostBack="true"
<asp:CheckBox id="chbIsActive" runat="server" AutoPostBack="true"></asp:CheckBox>
2、CheckBox控件的事件须在DataGrid的ItemCreated定义才能生效
private void grdStructure_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
private void chbIsActive_CheckedChanged(object sender, EventArgs e)
{
CheckBox chbIsActive = (CheckBox)sender;
Guid structureUID = new Guid(chbIsActive.Attributes["StructureUID"]);
bool isActive = chbIsActive.Checked;
IPMStructureManager manager = PMStructureManagerFactory.GetInstance();
manager.SetActive(structureUID, isActive);
this.Binding();
}
1、CheckBox控件需要设置AutoPostBack="true"
<asp:CheckBox id="chbIsActive" runat="server" AutoPostBack="true"></asp:CheckBox>
2、CheckBox控件的事件须在DataGrid的ItemCreated定义才能生效
private void grdStructure_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
private void chbIsActive_CheckedChanged(object sender, EventArgs e)
{
CheckBox chbIsActive = (CheckBox)sender;
Guid structureUID = new Guid(chbIsActive.Attributes["StructureUID"]);
bool isActive = chbIsActive.Checked;
IPMStructureManager manager = PMStructureManagerFactory.GetInstance();
manager.SetActive(structureUID, isActive);
this.Binding();
}
相关文章推荐
- DataGrid中使用CheckBox的CheckedChanged事件
- DataGrid中使用CheckBox的CheckedChanged事件
- DataGrid中使用CheckBox的CheckedChanged事件
- 在DataGrid里面使用CheckBox的例子
- GridView、DataGrid使用DataBound事件前提
- GridView中的CheckBox单击事件(oncheckedchanged)
- DataGrid模板列的CheckBox事件定义方法
- checkbox复选框使用及选定事件
- 用代码创建DataGrid的多链接及checkbox事件响应
- datagrid,checkbox混合使用
- GridView/DataGrid 模板列中使用自动回发的 CheckBox/DropDownList
- [Silverlight]简单实现DataGrid使用CheckBox选择行
- easyui datagrid editor onBeforeEdit事件下使用getEditor和getEditors失效
- 将使用DataGrid进行数据绑定,使用Javascript控制当选中其中的checkbox时,该行颜色改变
- 如何循环并通过使用 ASP.NET 和 VisualC # .NET 检查 DataGrid 列中 CheckBox 控件值
- 用代码创建DataGrid的多链接及checkbox事件响应(收藏)
- flex DataGrid与CheckBox的使用,表头也加上CheckBox
- DataGrid中使用CheckBox的CheckedChanged事件
- WPF datagrid 中 DataGridComboBoxColumn 和 DataGridCheckBoxColumn 使用方法
- DataGrid中使用CheckBox时根据帮定的数据显示不同的效果