zoukankan
html css js c++ java
手动写GridView的RowEditing RowCancelingEdit RowUpdating RowDeleting 事件 和 删除 出现提示
先定一个绑定的方法
void
Bind()
{
this
.GridViewUser.DataSource
=
new
BILL.OperateUser().SelectOneUserSqlComd();
this
.GridViewUser.DataBind();
}
protected
void
GridView1_RowEditing(
object
sender, GridViewEditEventArgs e)
{
//
索引编辑时
this
.GridViewUser.EditIndex
=
e.NewEditIndex;
Bind();
}
protected
void
GridView1_RowCancelingEdit(
object
sender, GridViewCancelEditEventArgs e)
{
//
编辑结束时
this
.GridViewUser.EditIndex
=
-
1
;
Bind();
}
protected
void
GridViewUser_RowUpdating(
object
sender, GridViewUpdateEventArgs e)
{
//
更新时
this
.GridViewUser.EditIndex
=
-
1
;
Bind();
}
GridView的AutoGenerateDeleteButton
=
"
True
"
AutoGenerateEditButton
=
"
True
"
//
删除出现提示
protected
void
GridViewUser_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
//
如果是绑定数据行
if
(e.Row.RowType
==
DataControlRowType.DataRow)
{
if
(e.Row.RowState
==
DataControlRowState.Normal
||
e.Row.RowState
==
DataControlRowState.Alternate)
{
//
找到生成“删除”所在单元格
LinkButton lb
=
(LinkButton)e.Row.Cells[
0
].Controls[
2
];
lb.Attributes.Add(
"
onclick
"
,
"
javascript:return confirm('你确认要删吗?')
"
);
}
}
}
查看全文
相关阅读:
一步一步开发sniffer(Winpcap+MFC)(五)莫道无人能识君,其实我懂你的心——解析数据包(转)
boost.property_tree解析xml的帮助类以及中文解析问题的解决(转)
boost.xml_parser中文字符问题 (转)
关于#progma comment 中库文件相对路径问题
关于VC预定义常量_WIN32,WIN32,_WIN64(转)
VS2010环境下Winpcap配置方法 (转)
开源框架完美组合之Spring.NET + NHibernate + ASP.NET MVC + jQuery + easyUI 中英文双语言小型企业网站Demo(转)
libnids关于计算校验和引起的抓不到包的现象的解决方法
LINK:fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 (转)
用.Net打造一个移动客户端(Android/IOS)的服务端框架NHM(四)——Android端Http访问类(转)
原文地址:https://www.cnblogs.com/a121984376/p/1245906.html
最新文章
java 中的 |=、&=、^=
java 装箱和拆箱
java中的位运算符 >> ^ ~ & |
Groovy 字符串那点儿事儿
Groovy 引号标识符
架设证书服务器 及 让IIS启用HTTPS服务(转)
Apache Solr查询语法(转)
jquery判断checkbox是否选中及改变checkbox状态(转)
solr中重建索引(转)
solr之定时增量索引实现
热门文章
从UEditor内容中获取指定节点值(转)
基于文件过滤驱动的透明加密那点事儿(转)
VC++网络安全编程范例(11)-SSL高级加密网络通信(转)
加密入门(三):TrueCrypt(转)
[How To] TrueCrypt使用教學
解密gzip压缩的网页数据流(转)
boost 线程安全队列
libnids使用 (转)
vs2010编译错误(报错:LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏)
Amazon.com 美国亚马逊 直邮中国 手把手教程(转)
Copyright © 2011-2022 走看看