protected void gvCategory_RowDataBound(object sender, GridViewRowEventArgs e)
{
ImageButton imgbtn = (ImageButton)e.Row.FindControl("del");
if (imgbtn != null)
{
imgbtn.Attributes.Add("onclick","return confirm('确定要删除吗')");
}
}
前台写法
OnClientClick="javascript:return confirm('删除该类别,其下所有新闻也将删除!\n\n你确定要删除吗?');"
本文介绍如何在ASP.NET中使用GridView控件时为删除操作添加客户端确认提示,通过具体代码示例展示了如何设置 ImageButton 的 OnClientClick 属性来实现这一功能。
2974

被折叠的 条评论
为什么被折叠?



