【问题标题】:asp.net linkbutton does not fire with nested childs in updatepanelasp.net 链接按钮不会与更新面板中的嵌套子项一起触发
【发布时间】:2015-05-29 07:47:41
【问题描述】:

我在使用更新面板中的 asp.net 链接按钮时遇到了嵌套子元素的问题。

当我在更新面板中使用链接按钮时,onclick 事件可以通过 ajax 请求正常工作:

<asp:updatepanel runat="server" childrenastriggers="true">
<contenttemplate>
    <asp:repeater runat="server" id="myrpt">
        <itemtemplate>
            <asp:linkbutton runat="server">click me</asp:linkbutton>
        </itemtemplate>
    </asp:repeater>
</contenttemplate>
</asp:updatepanel>

所以,当我在链接按钮中插入一个 html 子项时,ajax 请求不会触发并将其作为回发请求执行:

<asp:updatepanel runat="server" childrenastriggers="true">
<contenttemplate>
    <asp:repeater runat="server" id="myrpt">
        <itemtemplate>
            <asp:linkbutton runat="server"><i class="fa fa-times"></i></asp:linkbutton>
        </itemtemplate>
    </asp:repeater>
</contenttemplate>
</asp:updatepanel>

任何机构都可以帮助我在更新面板中解决这个问题?

【问题讨论】:

    标签: asp.net ajax updatepanel linkbutton


    【解决方案1】:

    此问题已通过 web.config 文件中的此更改修复:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.web>
            <pages clientIDMode="AutoID" />
        </system.web>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多