protected void gvType_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LinkButton btn = (LinkButton)gvType.Rows[e.RowIndex].Cells[3].Controls[0];
btn.Attributes.Add("onclick","return confirm('您真的要删除吗?');");
}
这样写不好使
{
LinkButton btn = (LinkButton)gvType.Rows[e.RowIndex].Cells[3].Controls[0];
btn.Attributes.Add("onclick","return confirm('您真的要删除吗?');");
}
这样写不好使
解决方案 »
- 关闭showModalDialog,刷新父窗口的gridview
- ??怎么在后台获取绑定值<#Bind("Mobile")>
- 请教大家一个数据库问题
- DundasWebChart超过10列的问题,谢谢!
- 为什么我发的邮件都被放到垃圾邮件里了
- 用Windows NT集成安全设置可以登陆SQL Server,但用使用的用户名和密码却登陆不了,怎么办?
- .net外接程序里的OnConnection方法到低怎么写呀?
- 当网页名或目录名内包含有偶数个汉字时页面就打不开,提示无法找到网页,请问这是什么原因呀?谢谢了!急死俺了!!!
- 为什么这5天以来我打开这个论坛上.xml的文章全是奇怪的信息,5天以前只是有时候是这样,现在都是这样了。我只有在隔壁的机器上浏览帖子了
- 关于GridView中单击按钮新增一行的问题,谢谢大家!
- Is it meaning that I have to install SQL server in this Windows Server?
- 有没有人会写这个代码,谢谢了,着急!!!!
OnClientClick='return confirm("确定删除吗?");' Text='<%#DataBinder.Eval(Container.DataItem,"password") %>'></asp:LinkButton>
是这样的:
这个删除列是在GridView的一个邦定列
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
btn.Attributes.Add("onclick","return confirm('您真的要删除吗?');");
把它放到GridView的RowDataBinding事件中去,好像是这个事件,有没有ing记不太清了
{
if (e.Row.DataItemIndex >= 0)
{
LinkButton lb = (LinkButton)e.Row.Cells[0].Controls[0];
lb.Attributes.Add("onclick", "return window.confirm('你确定删除吗?');");
}
}
全世界最简单的添加删除确认把这段js代码放在head里,删除代码都不需要了,一劳永逸<script language="JavaScript">function delete_confirm(e)
{
if (event.srcElement.outerText=="删除")
event.returnValue=confirm("您确定要删除吗?注意:此操作不可恢复,请谨慎操作!");
}
document.onclick=delete_confirm;</script>
----------------------------------------------------------
www.cndigs.com掘客园--发掘、推荐软件开发资源,分享、交流技术开发心得
asp.net2.0资料
http://www.cndigs.com/search.php?search=asp.net%202.0&tag=true
asp.net资料
http://www.cndigs.com/search.php?search=asp.net&tag=true
ajax资料
http://www.cndigs.com/search.php?search=ajax&tag=true
{
if (event.srcElement.outerText=="删除")
event.returnValue=confirm("您确定要删除吗?注意:此操作不可恢复,请谨慎操作!");
}
document.onclick=delete_confirm;</script>实在是高