小弟是个菜鸟,想请教一个很菜的问题。
在GridView1_RowDeleting 事件中弹出确认、取消对话框,
如果用户点了确定,就执行删除的事件,否则是什么也不执行,这样写: this.RegisterStartupScript("confirm", "<script>window.confirm('若要进行单击确定,否则请单击取消');</script>");
不行的哦。各位大哥,帮忙告诉小弟吧,应该怎么写.
谢谢啦。
在GridView1_RowDeleting 事件中弹出确认、取消对话框,
如果用户点了确定,就执行删除的事件,否则是什么也不执行,这样写: this.RegisterStartupScript("confirm", "<script>window.confirm('若要进行单击确定,否则请单击取消');</script>");
不行的哦。各位大哥,帮忙告诉小弟吧,应该怎么写.
谢谢啦。
解决方案 »
- 不好意思 各位大虾 我又来了我这再谢谢各位了
- VS2008中文提示问题
- 急急急---使用ajax填充Repeater
- listbox索引超出范围。必须为非负值并小于集合大小。参数名: index
- 大型网站下的企业网店怎么做
- 低级问题:window.open()的详细参数解释是什么?及怎么样让一个窗口居中。
- 求0-100,且可以有小数的正则表达式!!
- gridview数据绑定问题
- 我学的是vs2005 如何在asp.net(C#)页面中加入FLASH动画啊???
- 急!关于radiobutton触发事件和dropdownlist绑定数据问题,来者有分!
- Button控件快捷键
- ==========无刷新文件上传问题?=========
this.LinkButton1.Attributes.Add("onclick","return confirm('您确定要进行【删除】操作吗?');" );
<a href="javascript: DeleteOneProduct('<%# Eval("intID") %>')">删除</a> function DeleteOneProduct(tempID) {
if (confirm("您确认删除所选调查?")) {
你的操作! }
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
{
LinkButton delte = (LinkButton)e.Row.FindControl("LinkButton1");
delte.Attributes.Add("onclick", "return confirm('你确定要删除该纪录吗?');");
}
}
}那就参考这个吧
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1"); string a = "确认删除该用户?"; //e.Row.Cells[1].Text; //第二列的值 e.Row.Cells[4].Attributes.Add("onclick", "return confirm('" + a + "');"); //删除时给出提示 ,其中 4 为点击的删除链接的 列的索引值,需要你的索引替换 } }
<div onclick="JavaScript:return confirm('确定删除吗?')">删除</div>
或者直接在aspx页面的删除按钮属性里加上onclientclick="return confirm('确认要删除吗?')";
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1"); string a = "确认删除该用户?"; //e.Row.Cells[1].Text; //第二列的值 e.Row.Cells[4].Attributes.Add("onclick", "return confirm('" + a + "');"); //删除时给出提示 ,其中 4 为点击的删除链接的 列的索引值,需要你的索引替换 } }