在网格内部,我在网格中有一个删除按钮,后面有一个代码来执行删除。
<asp:TemplateField HeaderText="Edit Controls" ItemStyle-Width="15%">
<ItemTemplate>
<asp:LinkButton ID="Lnk_Delete" ToolTip="Delete Message"
CommandArgument='<%#Eval("MsgID") %>' CommandName="Delete" runat="server">
<img id="Img1" src="Styles/Images/Delete.jpg" runat="server" /></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
protected void Grid_Messagetable_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
如果在执行删除之前弹出确认,一切正常。
答案 0 :(得分:6)
您可以使用following article中显示的OnClientClick
属性:
<asp:LinkButton
ID="Lnk_Delete"
runat="server"
ToolTip="Delete Message"
CommandArgument='<%#Eval("MsgID") %>'
CommandName="Delete"
OnClientClick="return confirm('Are you sure you want to delete this record?');">
<img id="Img1" src="Styles/Images/Delete.jpg" runat="server" />
</asp:LinkButton>
答案 1 :(得分:0)
尝试添加
OnClientClick="return confirm('Do you want Delete?');"
答案 2 :(得分:0)
onClientClick="return confirm('Are you sure you want to delete?')";