Search code examples
asp.netvb.netupdatepanel

clientidmode static is not working with updatepanel which forces full postback


I have RadioButtonList & Listvie in my page. I am using update panel to avoid postback Now my radioButtonList works as filter for listview. My Problem is in my radiobuttonList I have to use clientIDmode=static but if I do that then my updatepanel has no use since there is full postback when radiobuttonList gets changed. How to solve this problem without removing clientIdmode=static. I seen some solution for kind of same post but really didn't understand. Please help me.

My code has following structure.

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

Solution

  • There is an issue with your script.

    You script is not being called after postback.

    So use as below,

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