1:定義刪除按鈕
<asp:Button ID="btnDelete" runat="server" Text="刪除" OnClientClick="javascript: return ShowMessage()"
OnClick="btnDelete_OnClick" CommandArgument='<%# Eval("Id") %>' />
2:添加對應的腳本
復制代碼 代碼如下:
<script language="javascript" type="text/javascript" >
function ShowMessage() {
return confirm("要刪除該項嗎?");
}
</script>