zoukankan
html css js c++ java
DataGrid中使用CheckBox的CheckedChanged事件
使用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)
{
if
(e.Item.ItemType
==
ListItemType.Item
||
e.Item.ItemType
==
ListItemType.AlternatingItem)
{
CheckBox chbIsActive
=
e.Item.FindControl(
"
chbIsActive
"
)
as
CheckBox;
chbIsActive.CheckedChanged
+=
new
EventHandler(chbIsActive_CheckedChanged);
}
}
3、编写事件代码
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();
}
查看全文
相关阅读:
九度OJ 1035:找出直系亲属 (二叉树、递归)
九度OJ 1034:寻找大富翁 (排序)
九度OJ 1033:继续xxx定律 (基础题)
九度OJ 1032:ZOJ (基础题)
centos 6.4 安装mongodb
数据校验工具类
《 mongodb 学习 》java 基本操作
《 mongodb 学习 》基本操作2
《 mongodb 学习 》之基本操作
《 mongodb 学习 》之安装篇
原文地址:https://www.cnblogs.com/chenjunbiao/p/1760271.html
最新文章
Android系统架构与系统源码目录
win7 64位debug解决方法
Python Kivy 中文教程:安装(Windows)
Qt Designer中文入门教程
QT学习资源
PyQt5
pip install PyQt5-tools
Angular2.0学习
LeetCode118-杨辉三角(水题,犯了Java引用的错误)
LeetCode67-二进制求和(很长的水题)
热门文章
LeetCode58-最后一个单词的长度(非常恶心的水题)
LeetCode53-最大连续子序列(有点意思的动态规划)
Nodejs里面使用Appium
jQuery基础-事件
九度OJ 1041:Simple Sorting(简单排序) (排序)
九度OJ 1040:Prime Number(质数) (递归)
九度OJ 1039:Zero-complexity Transposition(逆置) (基础题)
九度OJ 1038:Sum of Factorials(阶乘的和) (DP、递归)
九度OJ 1037:Powerful Calculator(强大的计算器) (大整数运算)
九度OJ 1036:Old Bill (老比尔) (基础题)
Copyright © 2011-2022 走看看