按了删除键后怎么先弹出一个框框警告要不要删除?
请问怎么在这段程序里面加入点击删除键后,弹出确认删除对话框?? 的程序,谢谢。private void DataShow_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string strSql = "delete from tbl_WorkOrdr where ID="+e.Item.Cells[0].Text+"";
ExecuteSql(strSql);
} --------------------编程问答-------------------- <ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
OnClientClick='return confirm("你确定你要删除吗?");'
Text="删除"></asp:LinkButton>
</ItemTemplate> --------------------编程问答-------------------- onclick="JavaScript:return confirm('确定要永久删除吗?')">删除</div>" --------------------编程问答-------------------- 错了,应该是
<asp:ButtonColumn Text="<div id="delete" onclick="JavaScript:return confirm('确定要永久删除吗?')">删除</div>"
HeaderText="删除" CommandName="Delete">
<HeaderStyle Wrap="False" ForeColor="White"></HeaderStyle>
另外,同意1楼的 --------------------编程问答-------------------- protected void DataShow_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
删除控件类型 db = (删除控件类型)e.Row.Cells[0].Controls[0];
db.OnClientClick = string.Format("return confirm('你确定要删除吗?'));
}
} --------------------编程问答-------------------- protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lb = new LinkButton();
lb = (LinkButton)e.Item.FindControl("LinkButton1");
lb.Attributes.Add("onclick", "return confirm('确定要将此文章删除吗?');");
}
} --------------------编程问答--------------------
protected void DataShow_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lb = (LinkButton)e.Item.FindControl( "LinkButton1");
lb.Attributes.Add( "onclick ", "return confirm( '确定要删除吗? '); ");
}
}
补充:.NET技术 , ASP.NET