问题描述
请问怎么在这段程序里面加入点击删除键后,弹出确认删除对话框??的程序,谢谢。privatevoidDataShow_DeleteCommand(objectsource,System.Web.UI.WebControls.DataGridCommandEventArgse){stringstrSql="deletefromtbl_WorkOrdrwhereID="+e.Item.Cells[0].Text+"";ExecuteSql(strSql);}
解决方案
解决方案二:
<ItemTemplate><asp:LinkButtonID="LinkButton1"runat="server"CausesValidation="False"CommandName="Delete"OnClientClick='returnconfirm("你确定你要删除吗?");'Text="删除"></asp:LinkButton></ItemTemplate>
解决方案三:
onclick="JavaScript:returnconfirm('确定要永久删除吗?')">删除</div>"
解决方案四:
错了,应该是<asp:ButtonColumnText="<divid="delete"onclick="JavaScript:returnconfirm('确定要永久删除吗?')">删除</div>"HeaderText="删除"CommandName="Delete"><HeaderStyleWrap="False"ForeColor="White"></HeaderStyle>另外,同意1楼的
解决方案五:
protectedvoidDataShow_RowDataBound(objectsender,GridViewRowEventArgse){if(e.Row.RowType==DataControlRowType.DataRow){删除控件类型db=(删除控件类型)e.Row.Cells[0].Controls[0];db.OnClientClick=string.Format("returnconfirm('你确定要删除吗?'));}}
解决方案六:
protectedvoidRepeater1_ItemCreated(objectsender,RepeaterItemEventArgse){if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem){LinkButtonlb=newLinkButton();lb=(LinkButton)e.Item.FindControl("LinkButton1");lb.Attributes.Add("onclick","returnconfirm('确定要将此文章删除吗?');");}}
解决方案七:
protectedvoidDataShow_RowDataBound(objectsender,GridViewRowEventArgse){if(e.Row.RowType==DataControlRowType.DataRow){LinkButtonlb=(LinkButton)e.Item.FindControl("LinkButton1");lb.Attributes.Add("onclick","returnconfirm('确定要删除吗?');");}}