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);
}
}
查看全文
相关阅读:
结对-贪吃蛇游戏结对编项目设计文档
java基础语法day04
java基础语法day03
轻量化ViewController的几个小技巧
__weak与__block修饰符的区别
OC与Swift的主要区别
copy与retain /深拷贝与浅拷贝
如何理解MVC设计模式
iOS常见加密方法
关于RunLoop
原文地址:https://www.cnblogs.com/kingboy/p/1034863.html
最新文章
本地安装Linux
《团队-中国象棋-模块测试过程》
《团队-中国象棋-模块开发过程》
《结对-贪吃蛇游戏-最终程序》
课后作业-阅读任务-阅读提问-3
团队-团队编程项目中国象棋-项目进度
结对-贪吃蛇游戏-测试过程
结对-贪吃蛇-开发过程
课后作业-阅读任务-阅读提问-2
2017/9/29-构建之法:现代软件工程-阅读笔记2
热门文章
结队-贪吃蛇-项目进度
《结对-结对编项目作业名称-最终程序》
团队编程项目作业3-模块测试过程
团队编程项目作业3-模块开发过程
课后作业-团队编程项目进度
结对编程项目作业4
团队编程项目作业2-团队编程项目代码设计规范
团队编程项目作业2-团队编程项目设计文档
团队编程项目作业2-团队编程项目开发环境搭建过程
结对编程项目作业2-贪吃蛇开发环境搭建过程
Copyright © 2011-2022 走看看