删除提示
我用GridView绑定数据后,后面放个子LinkButton作为删除给这个LinkButton写一些删除的方法..成功呢可以删除的
但我要他给我一个提示,你是否真的删除.确认和取消
应该怎么实现,可以用脚本判断吗.谁给我一段代码,谢谢 --------------------编程问答-------------------- http://zhidao.baidu.com/question/52500279.html?fr=qrl --------------------编程问答-------------------- linkbutton1.Attribute["onclick"]="return confirm('确认删除')"; --------------------编程问答-------------------- protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
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('你确定要删除该纪录吗?');");
}
}
} --------------------编程问答--------------------
--------------------编程问答-------------------- 直接在onclick里加 confirm --------------------编程问答-------------------- 重说一下,在控件上右键编辑模板->去里面找控件,有个OnClientClick属性 --------------------编程问答-------------------- <asp:LinkButton Runat="server" ID="ldel" OnClientClick ="javascript:if(confirm('是否真的要删除吗?\n\n系统提示:删除后不可恢复!')){return true;}else{return false;}" CommandName ="ldel" CommandArgument='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "hyid")) + "," + Convert.ToString(DataBinder.Eval(Container.DataItem, "jsrid"))%>'> 删除好友</asp:LinkButton></td>
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton btnDelete= (LinkButton)e.Row.FindControl("LinkButton1");
btnDelete.Attributes.Add("onclick", "return confirm('你确定要删除该记录吗?');");
}
}
--------------------编程问答-------------------- protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
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('你确定要删除该纪录吗?');");
}
}
} --------------------编程问答--------------------
就这种方法了
补充:.NET技术 , ASP.NET