为gridview删除添加提示

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //在服务器端添加删除确认
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
             LinkButton btnDelete = (LinkButton)e.Row.FindControl("LinkButton1");
             btnDelete.Attributes.Add("onclick", "javascript:return " +"confirm('Are you sure you want to delete this record " +DataBinder.Eval(e.Row.DataItem, "编号") + "')");
        }
     }
posted @ 2006-10-08 12:33  Juniy  阅读(256)  评论(1编辑  收藏  举报