简体   繁体   中英

Jquery to be reloaded in update panel Not Working in asp.net 3 tier

Masterpage.master : at the End i had my jqueries as below

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-ui/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<script src="js/iCheck/jquery.icheck.js"></script>
<script src="js/icheck-init.js" type="text/javascript"></script>

For Partial page Update need to reload Jquery

<script type="text/javascript" language="javascript">
    function pageLoad() {            
        $(function () {
            $(function () { // init
                $('.square-green input').iCheck({
                    checkboxClass: 'icheckbox_square-green',
                    radioClass: 'iradio_square-green',
                    increaseArea: '20%' // optional
                });
            });
             $("#rdbtn_img").iCheck('toggle', function () {
                $("#rdbtn_img").on('ifChecked', function (event) {
                    // shown
                });
                $("#rdbtn_img").on('ifUnchecked', function (event) {
                    // hide                
                });
            }); 
        });
    }        
</script>
<asp:UpdatePanel ID="upnl_logoupdate" runat="server">
<ContentTemplate>
<input type="radio" id="rdbtn_img" name="demo-radio"></input>
</ContentTemplate>
</asp:UpdatePanel>

Followed the link Link

Your jQuery init functions are being hidden by the pageLoad function that you nested them in.

function pageLoad() {            
        $(function () {
            $(function () { // init
                $('.square-green input').iCheck({
                    checkboxClass: 'icheckbox_square-green',
                    radioClass: 'iradio_square-green',
                    increaseArea: '20%' // optional
                });
            });
             $("#rdbtn_img").iCheck('toggle', function () {
                $("#rdbtn_img").on('ifChecked', function (event) {
                    // shown
                });
                $("#rdbtn_img").on('ifUnchecked', function (event) {
                    // hide                
                });
            }); 
        });
    }        

$(function () { // init
    $('.square-green input').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
        increaseArea: '20%' // optional
    });
    $("#rdbtn_img").iCheck('toggle', function () {
        $("#rdbtn_img").on('ifChecked', function (event) {
             // shown
        });
        $("#rdbtn_img").on('ifUnchecked', function (event) {
             // hide                
        });
    });
});        

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