简体   繁体   English

更新面板内的模式弹出窗口上的按钮事件

[英]button event on modal popup inside an update panel

I am having a modal popup inside an update panel. 我在更新面板中有一个模式弹出窗口。 I am having 2 buttons on that modal popup. 我在该模式弹出窗口上有2个按钮。 But when I click on the button, the buttons event is not getting fired up. 但是,当我单击按钮时,按钮事件并未触发。 I have mentioned the id's of the buttons in the trigger part of the update panel. 我已经提到了更新面板的触发器部分中按钮的ID。 Here is my code. 这是我的代码。

    <asp:ModalPopupExtender ID="MessageBox" runat="server" TargetControlID="FakeLabel"
        PopupControlID="pnl_Message" BackgroundCssClass="modalBackground" OkControlID="Btnok">
    </asp:ModalPopupExtender>
    <asp:Label ID="FakeLabel" runat="server" />

    <asp:Panel ID="pnl_Message" runat="server" CssClass="popup_menu"
        BorderWidth="1" Width="40%">
        <table width="100%">
            <tr>
                <td>
                    <asp:Button ID="btn_cancel" runat="server" Width="38px" OnClick="btn_cancel_Click"></asp:Button>

                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="Btnok" runat="server" Text="OK" Width="38px" OnClick="Btnok_Click" />

                </td>

            </tr>
        </table>
    </asp:Panel>

</ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="Button1" />
            <asp:PostBackTrigger ControlID="btn_Update" />
            <asp:PostBackTrigger ControlID="btn_Delete" />
            <asp:PostBackTrigger ControlID="btn_Clear" />

            <asp:PostBackTrigger ControlID="btn_cancel" />
            <asp:PostBackTrigger ControlID="Btnok" />
        </Triggers>

    </asp:UpdatePanel>

cs code : CS代码:

    pnl_Message.Visible = true;
    MessageBox.Show();


protected void Btnok_Click(object sender, EventArgs e)
    {
        try
        {

        }
        catch (Exception ex)
        {

            lbl_mesg.Text = ex.Message;
        }
    }

My btnok event is not getting fired up. 我的btnok事件没有被触发。 How do i solve the problem. 我该如何解决问题。 Please help. 请帮忙。

在模式弹出窗口中添加此属性BehaviorID =“ popup”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM