I am having a modal popup inside an update panel. I am having 2 buttons on that modal popup. 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. 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 :

    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. How do i solve the problem. Please help.

有帮助吗?

解决方案

Add this attribute BehaviorID="popup" in modal pop up

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top