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

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - 使名扬

vs.net 2005 C# WinForm GroupBOX 的BUG?尝试读取或写入受保护的内存。这通常指示其他内存已损坏 windows2003双网卡安装openmeetings成功后登录页空白 access top order by的逻辑问题 解决vs2005中文乱码问题 登录失败:用户帐户限制。可能的原因包括不允许空密码,登录时间限制,或强制的策略限制。 - 使名扬 - 博客园 DataList父子嵌套 VS2008 母版页嵌套母版页,下级母版页不执行Page_Load解决方法 - 使名扬 - 博客园 360会导致MSDN "无法显示该网页" - 使名扬 - 博客园 asp.net下使用FCKeditor 2.6.6 in ,exists ,join sql server 2000中了解各表的记录数 oracle树形sql查询 谨慎使用windows 2003 64位版 带日期,时间和闰年验证的正则式 关于vs.net 2003向vs.net 2005迁移后,注册事件丢失,"并不包含...的定义" 的解决方法 - 使名扬 走进非洲,发现全错了-关于sqlserver2000下全球化网站生僻语种sql查询的解决方案 MSDN上关于sqlserver 万能分页原理实现的一个致命错误 BUGReport:datagrid带模板列绑定空数据集出错的问题 Asp.net 2.0 Webpart 数据库的迁移
gridview中如何添加对某行删除时的确认提示框
使名扬 · 2010-09-30 · via 博客园 - 使名扬

1.在RowDateBound事件中添加:
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {          
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
                {
                    ((LinkButton)e.Row.Cells[1].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除名称为:\"" + e.Row.Cells[3].Text.ToString().Trim() + "\" 的票据类型吗?')");
                }
            }
        }


2.转为模板列,在前台直接添加:
<asp:TemplateField HeaderText="删除" ShowHeader="False">
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButton10" runat="server"
                            OnClientClick="javascript:return confirm('您是否确认要删除选定的送货单?');"
                             CommandName="Delete" CausesValidation="False"
                                ImageUrl="~/images/Gridview_Delete/record_delete_16x16.gif" />
                        </ItemTemplate>
                    </asp:TemplateField>

对比DataGrid

  protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LinkButton lb = (LinkButton)e.Item.Cells[4].Controls[0];
                lb.Attributes.Add("onclick", "javascript:if(!window.confirm('Delete,YES or NO ?')) return false;");
            }
        }