单击Gridview中单击删除链接按钮时,确认删除记录框未显示 [英] Confirm delete record box not showing on clicking delete link button in Gridview

查看:99
本文介绍了单击Gridview中单击删除链接按钮时,确认删除记录框未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview,其中我在所有行中都有一个命令字段删除按钮。删除按钮工作正常并在单击时删除记录但没有显示''您确定要删除此记录吗删除之前在屏幕上弹出。我已将以下代码添加到Gridview的RowDataBound事件中。



if(e.Row.RowType == DataControlRowType。 DataRow && gvrecord.EditIndex == e.Row.RowIndex)

{

((LinkBut​​ton)e.Row.Cells [15] .Controls [0])。属性[ onclick] =返回确认(''您确定要删除此记录!'');;

}



但是,它不起作用。我无法弄清楚问题是什么。任何人都可以帮忙吗?

I have a gridview in which I have a command field Delete button in all the rows.The Delete button is working fine and deleting the record when clicked but it is not showing the ''Are you sure you want to delete this record'' popup on the screen before deleting.I have added the following code to my RowDataBound event of the Gridview.

if (e.Row.RowType == DataControlRowType.DataRow &&gvrecord.EditIndex==e.Row.RowIndex)
{
((LinkButton)e.Row.Cells[15].Controls[0]).Attributes["onclick"] = "return confirm(''Are you certain you want to delete this record!'');";
}

But,it is not working.I can''t figure out what the problem is.Can anybody please help?

推荐答案

试试这个: - http://www.aspdotnet-suresh.com/2011/ 01 /如何到删除,记录功能于gridview的-with.html [ ^ ]
Try This one : - http://www.aspdotnet-suresh.com/2011/01/how-to-delete-records-in-gridview-with.html[^]


<script language="javascript" type ="text/javascript" >


function DeleteConfirmation() {
    if (confirm("Está seguro que quiere eliminar la regla?") == true) {
        return true;
    }
    else {
        return false;
    }
}
</script>







在linkbutton


OnClientClick =return DeleteConfirmation();




Call this function on linkbutton

OnClientClick="return DeleteConfirmation();"


尝试一次......



try it once...

if (e.Row.RowType == DataControlRowType.DataRow &&gvrecord.EditIndex==e.Row.RowIndex)
{
((LinkButton)e.Row.Cells[15].Controls[0]).Attributes["onclick"] = "javascript:return confirm('Are you certain you want to delete this record!');";
}


这篇关于单击Gridview中单击删除链接按钮时,确认删除记录框未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆