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);
}
}
查看全文
相关阅读:
Go复习--为何不允许重载overload?
Go疑问-1
Go复习--for循环陷井
Go复习--slice协程不安全
Go复习之久违的goto语句
Go复习---编译错误:undefined:
Linux 环境拷贝文件发生的错误
【转载】java数据库操作
VBA文件处理
【转】关于C#使用Excel的数据透视表的例子
原文地址:https://www.cnblogs.com/kingboy/p/1034863.html
最新文章
JavaScript之 函数节流(Throttling) 与 防抖(Debounce)
JavaScripts之迪卡算法求积(n*n)适用于SKU信息计算等场景
CSS实现事件穿透与背景图不跟随滚动条
window-server 服务器解决远程连接
Nginx同server配置下配置多个localhost路由地址
java HSSFWorkbook 实现Excel导出
Springboot2.x整合Swagger3.x
MyBatisPlus优缺点
Mybatis-plus-generator逆向工程
MybatisPlus 逻辑删除配置使用
热门文章
MybatisPlus 乐观锁插件使用
Mybatis Plus ActiveRecord使用
mybatis select查询性能优化问题
mybatis plus QueryWrapper基本应用
Mybatis plus 分页插件使用
Go复习---南方电网厂家状态监测系统
Python复习
Go-复习-方法receiver
Go-复习
Go复习--chan close range
Copyright © 2011-2022 走看看