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);
}
}
查看全文
相关阅读:
vmware下玩ubuntu总结
.Net Json 字典序列化
Flex Air TitleWindow 拖动范围控制
TimesTen 问题荟萃
TimesTen 时间戳(timestamp)用法
批量数据插入 (.Net, ODBC)
腾讯 360浏览器 调用js问题
[转]Android项目源码混淆问题解决方法
Intent调用大全
View实现涂鸦、撤销以及重做功能【转】
原文地址:https://www.cnblogs.com/kingboy/p/1034863.html
最新文章
Python核心数据类型——概览
Python核心数据类型——数字
【原创】无法重新组织表 ; 的索引 (分区 1),因为已禁用页级锁定
【原创】利用typeperf工具收集SQL Server性能数据
【原创】SQL Server 2005复制(二.应用中遇到的问题)
【原创】SQL Server 2005复制(一.可用性测试评估)
【原创】SQL Server 生成脚本的一些参数说明
[linux_shell]linux下设置ls命令显示文件、文件夹颜色
[zz]配置你的 csh/tcsh
Linux终端常用快捷键
热门文章
[cygwin]mintty窗口中输出的中文是乱码
[Linux常用命令]bind
[Linux常用命令]touch
cygwin默认shell配置文件
[linux_shell]Bash通配符与特殊符号
[linux_shell]数据流重定向
[Linux常用命令]Unix & Linux 命令分类表
Des 加密解密 .NetFlex
Mongodb 数据库小知识点
Actionscript 里面怎么设置常见中文字体,例如黑体等
Copyright © 2011-2022 走看看