当前注册人数422991人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

Extending the GridView CommandField To Add Delete Confirmation

扩展了添加删除确认提示框的GridView控件源代码

2008年03月04日
C#, JScript, C# 2.0, Windows, .NET, .NET 2.0, ASP.NET, VS, VS2005, Dev, Design
这个程序扩展了ASP.NET中GridView控件,使得CommandField支持在用户点击添加、删除行数据时,弹出消息提示框等待用户确认的功能。
相关知识
/// 
/// An extended  that allows deletions
/// to be confirmed by the user.
/// 
public class ExtendedCommandField : CommandField
{
    /// 
    /// Initialize the cell.
    /// 
    public override void InitializeCell(DataControlFieldCell cell, 
        DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
    {
        base.InitializeCell(cell, cellType, rowState, rowIndex);
        if (!string.IsNullOrEmpty(this.DeleteConfirmationText) && this.ShowDeleteButton)
        {
            foreach (Control control in cell.Controls)
            {
                IButtonControl button = control as IButtonControl;
                if (button != null && button.CommandName == "Delete")
                    // Add delete confirmation
                    ((WebControl)control).Attributes.Add("onclick", string.Format
                    ("if (!confirm('{0}')) return false;", this.DeleteConfirmationText));
            }
        }
    }
源代码原文下载:
Extending the GridView CommandField To Add Delete Confirmation Tired of constantly writing the same labourious plumbing to add a confirmation to a delete button in a GridView? I was, so I simplified things.

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载347次)

最值得关注的外文源代码

Event Calendar [ ASP.NET 2.0 / C# ]
Edit Individual GridView Cells in ASP.NET
Gridview Control with print and preview features
DataGrid with built-in filter functionality
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论46次,此处显示最近20次评论! 查看所有评论

Agui  2022年11月02日
太好了,下载看看怎么样
zjwen2007  2014年12月29日
看样子挺好的,先下载玩一下
niaiyaolong  2013年10月05日
还没有下载。先谢谢楼主的分享
gn_2012  2013年03月18日
不错
hua  2012年03月08日
taihaole
sx  2011年12月27日
好东西,收藏使用哦!
情缘  2011年12月01日
反复反复反复反复
多情剑客无情剑  2011年07月04日
写的很好
cena  2011年01月27日
谢谢!值得试试
gg  2010年06月16日
老鼠一发威,大家都是病猫。
yaoer  2010年03月17日
不错
殘兵  2009年12月31日
不错
三缺一  2009年07月03日
不错
ginger  2009年05月04日
厉害!
空空吧  2009年04月14日
好东西,收藏使用哦!现在正好做这个····
影子  2009年03月02日
顶啊,好东东
liqbzy  2008年12月06日
改进的很好
maoxiaofeng  2008年10月12日
谢谢啊
jam  2008年10月01日
比较简单啊
66888888  2008年09月05日
这个比较简单
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明