clientidmode static 不适用于强制完全回发的 updatepanel

clientidmode static is not working with updatepanel which forces full postback

我的页面中有 RadioButtonList 和 Listvie。我正在使用更新面板来避免 postback 现在我的 radioButtonList 用作列表视图的过滤器。我的问题出在我的 radiobuttonList 中,我必须使用 clientIDmode=static 但如果我这样做,那么我的更新面板就没有用了,因为当 radiobuttonList 被更改时,postback 已满。如何在不删除 clientIdmode=static 的情况下解决此问题。我看到了一些类似 post 的解决方案,但真的不明白。请帮助我。

我的代码结构如下。

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="areasList" CssClass="mark" AutoPostBack="true" runat="server" ClientIDMode="static" RepeatLayout="Flow">
</asp:RadioButtonList>
ListviewHere
</ContentTemplate>
</asp:UpdatePanel> 

您可以将 RadioButtonList 的 ClientIDMode 设置为 AutoID(如果这是默认值,则不在标记中指定该属性)并在客户端代码中使用绑定表达式来获取控件的实际ID:

$("#<%= areasList.ClientID %>")

document.getElementById('<%= areasList.ClientID %>')

您的脚本有问题。

回发后未调用您的脚本。

所以使用如下,

<script type="text/javascript">
    // below will execute after ajax postback
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

    function EndRequestHandler(sender, args) {
        //script
    }

    // executes after page load first time

    //script

</script>