ModalPopupExtender ASP MessageBox未关闭

时间:2013-02-07 03:53:19

标签: c# asp.net

我想要一个弹出消息框,显示类似“完成!”的内容。当我的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();
    }
}

我做错了什么?

0 个答案:

没有答案