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();
}
查看全文
相关阅读:
Linux下监视GPU、CPU的使用情况
2014多校第一场 E 题 || HDU 4865 Peter's Hobby (DP)
2014多校第一场 I 题 || HDU 4869 Turn the pokers(费马小定理+快速幂模)
2014多校第一场D题 || HDU 4864 Task (贪心)
2014多校第一场J题 || HDU 4870 Rating(DP || 高斯消元)
2014多校第一场A题 || HDU 4861 Couple doubi
POJ 2948 Martian Mining(DP)
POJ 2029 Get Many Persimmon Trees(DP||二维树状数组)
POJ 3280 Cheapest Palindrome(DP)
POJ 4044 Score Sequence
原文地址:https://www.cnblogs.com/chenjunbiao/p/1760271.html
最新文章
写了一个关于《Delphi二维码、分组、批量》的帖子
Delphi FMX 手机目录提取,把IO相关的都提取到System.IoUtils单元中
sql怎么选择数据and和or能同时用吗???
数据结构-STL序列式容器总结
python语言特性简要记载
常见非线性优化算法总结(续)
梯度下降法中的梯度理解
最大似然估计 (MLE) 最大后验概率(MAP)
算法复习-a 到 z不完全排列生成
算法复习-判断数字的二进制1的个数
热门文章
最大熵模型 三
《Python Machine Learning》索引
【算法题11 求子集问题】
关于损失函数那些事儿
Python正则表达式Cheat sheet
【算法题10 不同路径问题】
【算法题9 螺旋矩阵问题】
关于Python有用的snippets
【算法题 8】跳跃游戏
【算法题7】寻找下一个排列
Copyright © 2011-2022 走看看