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);
}
}
查看全文
相关阅读:
[vue Debugger] sourcemap
[vuex]持久化存储
[vuex]字典值封装到vuex缓存
[vue]常用指令集合
VSCode插件集合
[element-ui] 表格点击出现编辑效果实现
[pdf] 插件实现pdf上传预览、打印
[html] 特殊字符
[element-ui] 穿梭框对象重复不添加方案
Redis持久化
原文地址:https://www.cnblogs.com/kingboy/p/1034863.html
最新文章
软件工程基础图式(第一章)
编译技术图式(第二章 实现一个简单的编译器)
编译技术图式(第一章 编译概述)
Java图式(第二章 Java语言基础)
图片水平垂直居中
ajax实例
js判断手指滑动方向(移动端)
百度地图API使用 摘抄
CSS3多列布局
表的增删查改
热门文章
关于hightcharts插件
time
hightcharts使用
hchart
reset02
css reset
css百分比
css3新增属性
关于touch的css
关于js的笔记
Copyright © 2011-2022 走看看