我想要一个弹出消息框,它会显示类似“完成!”的内容。当我的gridview中的行成功删除时,如果出现错误,还有其他内容。我使用了 ModalPopupExtender。模态弹出窗口显示正常,但即使我单击“确定”按钮,它也只会保留在页面上。这是我的代码:
ASP:
<!--ModalPopup for "Done" message-->
<asp:ModalPopupExtender ID="ModalPopupExtDone" runat="server" PopupControlID="donePanel" TargetControlID="donePanel" CancelControlID="donePanelBtn">
</asp:ModalPopupExtender>
<div class="panel">
<asp:Panel ID="donePanel" runat="server" Width="200px" Height="41px"
BackColor="#FF9900">
<asp:Label ID="donePanelLabel" runat="server" ForeColor="#FF3300"></asp:Label>
<br />
<asp:Button ID="donePanelBtn" runat="server" Text="OK"
onclick="donePanelBtn_Click" />
</asp:Panel>
</div>
代码背后:
protected void GridViewDept_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//some other code
if (delSuccess)
{
donePanelLabel.Text = "Record deleted!";
ModalPopupExtDone.Show();
this.RefreshGridView();
}
else
{
donePanelLabel.Text = "Record not deleted! Please try again!";
ModalPopupExtDone.Show();
}
}
我究竟做错了什么?