1. GridView加入編輯/刪除按鈕於最後
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
2. 於 rowdatabound 事件加入下面程式
if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == 0)
{
LinkButton lb = e.Row.Cells[e.Row.Cells.Count - 1].Controls[2] as LinkButton;
lb.OnClientClick = "if (!confirm('確定刪除?')) return false;";
}
沒有留言:
張貼留言