繁体   English   中英

图片按钮onclick事件未在ASP面板中触发

[英]Image button onclick event not fire in asp panel

我不知道为什么我的图像按钮在asp面板中的onclick和onclient click事件没有触发。希望帮助。

前端代码

<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事件

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

由于您实际上并未调用JavaScript函数,因此它可能无法正常工作。 尝试OnClientClick="hidePopup()" (带有方括号)。

更多信息: https//goo.gl/g9D8Rp

注意:OP编辑了答案,并删除了上述代码(在撰写本文时,该代码仍然错误)。

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

暂无
暂无

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

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