zoukankan
html css js c++ java
GridView加ObjectDataSource做删除事件(ObjectDataSourceStatusEventHandler 委托)
<
asp:GridView
ID
="GVAllMemo"
runat
="server"
AutoGenerateColumns
="False"
CellPadding
="4"
GridLines
="None"
Width
="80%"
AllowPaging
="True"
AllowSorting
="True"
DataSourceID
="ObjectDataSource1"
ForeColor
="#333333"
Font-Size
="9pt"
DataKeyNames
="ID"
>
<
FooterStyle
BackColor
="#5D7B9D"
ForeColor
="White"
Font-Bold
="True"
/>
<
RowStyle
BackColor
="#F7F6F3"
ForeColor
="#333333"
/>
<
SelectedRowStyle
BackColor
="#E2DED6"
Font-Bold
="True"
ForeColor
="#333333"
/>
<
PagerStyle
BackColor
="#284775"
ForeColor
="White"
HorizontalAlign
="Center"
/>
<
HeaderStyle
BackColor
="#5D7B9D"
Font-Bold
="True"
ForeColor
="White"
/>
<
Columns
>
<
asp:BoundField
DataField
="EndDate"
HeaderText
="提醒时间"
DataFormatString
="{0:yyyy年M月dd日}"
HtmlEncode
="False"
/>
<
asp:TemplateField
HeaderText
="具体事务"
>
<
ItemTemplate
>
<
a
href
="MemoShow.aspx?Date=<%# Eval("
EndDate") %
>
" class="f12_black" >
<%
#
Eval
(
"
event
"
)
%>
</
a
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
DataField
="StartDate"
HeaderText
="添加时间"
DataFormatString
="{0:yyyy年M月dd日}"
HtmlEncode
="False"
/>
<
asp:TemplateField
HeaderText
="完成状况"
>
<
ItemTemplate
>
<%
# Convert.ToInt32(
Eval
(
"
Flag
"
))
==
0
?
"
<img src='../images/ico_no.gif' alt='未完成'/>
"
:
"
<img src='../images/ico_ok.gif' alt='完成'/>
"
%>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
="编辑"
>
<
ItemTemplate
>
<
a
href
="MemoEdit.aspx?ID=<%# Eval("
id") %
>
" class="f12_black" > 编辑
</
a
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:CommandField
ShowDeleteButton
="True"
/>
</
Columns
>
<
EditRowStyle
BackColor
="#999999"
/>
<
AlternatingRowStyle
BackColor
="White"
ForeColor
="#284775"
/>
<
PagerSettings
FirstPageText
="首页"
LastPageText
="末页"
NextPageText
="下一页"
PreviousPageText
="上一页"
/>
</
asp:GridView
>
<
asp:ObjectDataSource
ID
="ObjectDataSource1"
runat
="server"
SelectMethod
="AllMemo"
TypeName
="JL.CRM.BLL.BllMemo"
DeleteMethod
="DelMemo"
OnDeleting
="GridView1_RowDeleting"
>
<
SelectParameters
>
<
asp:SessionParameter
Name
="KFnum"
SessionField
="KFnum"
Type
="Int32"
/>
</
SelectParameters
>
<
deleteparameters
>
<
asp:parameter
name
="ID"
type
="Int32"
/>
</
deleteparameters
>
</
asp:ObjectDataSource
>
C#代码段
protected
void
GridView1_RowDeleting(
object
source, ObjectDataSourceMethodEventArgs e)
{
BllMemo DelMemo
=
new
BllMemo();
IDictionary paramsFromPage
=
e.InputParameters;
if
(DelMemo.DelMemo(Int32.Parse(paramsFromPage[
"
ID
"
].ToString())))
{
JavaScript.Alert(
"
删除成功!
"
,
this
.Page);
GVAllMemo.DataBind();
}
else
{
JavaScript.Alert(
"
删除失败!
"
,
this
.Page);
}
}
查看全文
相关阅读:
使用sshfs挂载远程服务器目录
yum install --downloadonly 下载依赖包到本地 但不安装
CentOS 7安装SSHFS 实现远程主机目录 挂载为本地目录
CentOS7下FTP的安装与配置
标签传播算法(Label Propagation Algorithm, LPA)初探
线性模型(linear model)基本定义及参数求解数学本质、损失函数的选择与评估数学原理、及其基于线性模型衍生的其他机器学习模型相关原理讨论
贝叶斯A/B测试
谨慎选择我们的先验
关于年会抢红包游戏的一个思考
WMI攻击技术研究
原文地址:https://www.cnblogs.com/kingboy/p/1034863.html
最新文章
初学vue出现空格警告的原因及其解决办法
spring boot swagger-ui.html 404
各种分布式文件系统的比较
VuePress
Docker Compose安装以及入门
超详细动手搭建一个Vuepress站点及开启PWA与自动部署
PPTP服务端与客户端 修改默认PPTP默认端口1723
centos7防火墙iptables开放常用端口
PDF.js 分片下载的介绍2:分片下载demo
关于jmeter命令行执行.jmx文件出现Error in NonGUIDriver java.lang.RuntimeException: Could not find the TestPlan c
热门文章
使用 JMeter 进行压力测试
Centos7 设置、查看、添加、删除服务的开机启动项
python 调用 opencv 实现 图片文本倾斜校正
centos cron 自动执行脚本异常 命令不生效的解决办法
Java后端WebSocket的Tomcat实现
HTML5新特性[ Notifications ] 桌面消息
centos下mysql自动备份(亲测可用)
连接mysql 出现:java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
Windows IIS注册asp 此操作系统版本不支持此选项 错误解决方法
Centos7 初始化硬盘分区、挂载
Copyright © 2011-2022 走看看