日期:2014-05-18 浏览次数:20433 次
s+=" <td > <a onClick=\"return confirm('您真的要删除这条记录吗?')\" href= \""+delfile+"?"+primarykey+"="+mt.Rows[i][""+primarykey+""]+"\" >删除 </a > </td >";
------解决方案--------------------
protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
{
TableCell myCell;
myCell = e.Row.Cells[0];
LinkButton btnDel = (LinkButton)myCell.Controls[2];
btnDel.Attributes.Add( "onclick ", "return confirm( '您真的要删除此行吗? '); ");
btnDel.Text = "删除 ";
}
不知是不是用在gridview希望能帮到你
------解决方案--------------------
yourcontrol.Attributes.Add("onclick","return confirm( '确实要删除')";
------解决方案--------------------
确认对话框
/// <summary>
/// 服务器端弹出confirm对话框
/// </summary>
/// <param name="str_Message">提示信息,例子:"您是否确认删除!"</param>
/// <param name="btn">隐藏Botton按钮Id值,比如:btn_Flow</param>
/// <param name="page">Page类</param>
public void Confirm(string str_Message,string btn,Page page)
{
page.RegisterStartupScript("","<script> if (confirm('"+str_Message+"')==true){document.forms(0)."+btn+".click();}</script>");
}
------解决方案--------------------
s+=" <td > <a onClick=\"return confirm('您真的要删除这条记录吗?')\" href= \""+delfile+"?"+primarykey+"="+mt.Rows[i][""+primarykey+""]+"\" >删除 </a > </td >";
------解决方案--------------------
s+=" <td > <a onClick=\"if (window.confirm('您真的要删除这条记录吗?')){window.location='"+delfile+"?"+primarykey+"="+mt.Rows[i][primarykey]+"';}\" href= '#' >删除 </a > </td >";