惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
A
About on SuperTechFans
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
G
Google Developers Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Cloudbric
Cloudbric
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
H
Heimdal Security Blog
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Latest news
Latest news
I
Intezer
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Threatpost
博客园 - 【当耐特】
S
Schneier on Security
P
Privacy International News Feed
G
GRAHAM CLULEY
T
Tenable Blog
AWS News Blog
AWS News Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
博客园 - Franky
Engineering at Meta
Engineering at Meta
美团技术团队
S
Secure Thoughts
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - kingboy

miniSipServer简单而不简单,轻松落地,实现电脑对固话、手机通讯 sql 去重 C# 获取客户端信息 /asp.net/WebService/WebForm C#防止WebBrowser在新窗口中打开链接页面 常用sql语句 sql 复制表 获得 DataSet中的记录总数 MySQL安装的图解 sql 按日期查询 C#中的日期函数使用大全 火车座位分布图 javascript页面跳转常用代码 首页头部下拉广告设计(javascript) GridView 自定义分页 GridView日期格式模版列使用方法 (转) 非常酷的三级下拉菜单!!(javascript) JavaScript 强行弹出窗口 与 无提示关闭页面 sql事务处理(转) o(∩_∩)o...哈哈 在博客园安家了!!
GridView加ObjectDataSource做删除事件(ObjectDataSourceStatusEventHandler 委托)
kingboy · 2008-01-11 · via 博客园 - kingboy

<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>
                                
<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>
                                
<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);
        }

    
    }