ASP.NET2.0下為GridView新增伺服器端刪除確認!
作者:Eve Cole
更新時間:2009-06-30 17:02:30
protected void GridView1_RowDataBound(物件傳送者,GridViewRowEventArgs e)
{
//在伺服器端新增刪除確認
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton btnDelete = (LinkButton)e.Row.FindControl("LinkButton1");
btnDelete.Attributes.Add("onclick", "javascript:return " +"confirm('您確定要刪除這條記錄嗎" +DataBinder.Eval(e.Row.DataItem, "編號") + "')" ) ;
}
}