开发者

ModalPopupExtender Button Problem

I am trying to figure out why my ModalPopupExtender keeps closing, everytime a user clicks either button its running the code behind because I put a break point in and it is breaking there, but the modalPopup immediately closes, which isnt good because if it has any errors in the process they cant be displayed. So how do I stop the modalpopup from closing itself? I didnt specify a OKControlID or a CancelControlID.

Panel Code:

<asp:Panel ID="Panele" runat="server" style="display: none; position:absolute; top: 50%; left: 35%; width: 500px; height: 350px; background-color: White; border: solid 1px black; padding-left: 15px; text-align: left;">
        <asp:ImageButton ID="CloseEBtn" runat="server" 
        ImageUrl="images/CloseButton.png" style="float: right; margin-right: 3px; margin-top: 3px;" 
        onclick="CloseEBtn_Click" />
<strong>Name:<asp:TextBox ID="fromTextBox" runat="server"></asp:TextBox></strong>
    <asp:Button ID="SndBtn" runat="server" Text="Send" onclick="SndBtn_Click" />
&nbsp;<asp:Button ID="ClrBtn" runat="server" Text开发者_开发知识库="Clear" />
    <br />
    <br />
    <asp:Label ID="msglabel" runat="server"></asp:Label>
</asp:Panel>

My ModalPopupExtender Code:

<asp:ModalPopupExtender ID="popup" runat="server" 
    TargetControlID="SIBtn" PopupControlID="Panele" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>

CodeBehind:

    protected void SndBtn_Click(object sender, EventArgs e)
    {
        msglabel.Text = "The Window Didnt Close";
    }
    protected void ClrBtn_Click(object sender, EventArgs e)
    {
        fromTextBox.Text = "";
        toTextBox.Text = "";
        subjectTextBox.Text = "";
        MessageTextBox.Text = "";
        msglabel.Text = "";
    }


By code-behind running if you mean the page posts back, modal popups do not explicitly reload themselves. You have to write some code from the server to show the Modal Popup; there is a Server-side Show() method on the extender and a client-side show() method like:

$find("<%= mpe.ClientID %>").show();

HTH.


For me, UseSubmitBehavior="false" on the asp:Button did the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜