简体   繁体   中英

Image button onclick event not fire in asp panel

I wonder why my image button onclick and onclient click event in asp panel is not fire..hope help..thanks much.

Front end code

<asp:Panel ID="pnlPopup" CssClass="modalPopup panel" style="display:none;" runat ="server" Width = "510px" Height ="450px" >
    <table class="popuptitle round" style="width:100%; margin:0px 0px 10px 0px;" > 
        <tr> <td style="width:90%;" >
        Select Users
        </td> <td style="text-align:right; "><asp:ImageButton ID="btnPopupX" runat="server" ImageUrl="~/images/cross.png" CausesValidation="false" AlternateText="Close" OnClick="btnPopupX_Click" /> </td></tr>
    </table>

Onclick event

  protected void btnPopupX_Click(object sender, ImageClickEventArgs e)
        {
            switch (((ImageButton)sender).ID)
            {
                case "btnPopupX":
                    txtSearch.Text = "";
                    loadGrid2();
                    break;
            }
        }

It may not be working because you are not actually calling the JavaScript function. Try OnClientClick="hidePopup()" (with brackets).

More info: https://goo.gl/g9D8Rp

Note: OP edited answer and removed the code mentioned above (which was still in error at the time of this post).

在前端调用OnClientClick =“ hidePopup()”或在文件btnPopupX.attribute(“ onclick”,“ hidePopup()”)后面的代码中注册此函数;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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