Document.Ready() is not working after PostBack

前端 未结 8 1868
天命终不由人
天命终不由人 2020-12-02 18:39

I have a page that contains a user control within an update panel. $(document).ready(function() ) { is called and executes the code correctly when the page firs

8条回答
  •  余生分开走
    2020-12-02 19:01

    Bestest way is

    
                        Sys.Application.add_load(LoadScript);
         
     you hemla code gose here 
    
        
    

    Javascript function

    
    

    or

    Its under UpdatePanel than you need to register client script again using

    ScriptManager.RegisterClientScript
    

    or

    $(document).ready(function() {
        // bind your jQuery events here initially
    });
    
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    
    prm.add_endRequest(function() {
        // re-bind your jQuery events here
        loadscript();
    
    });
    
    
    $(document).ready(loadscript);
    
    function loadscript()
    {
      //yourcode 
    }
    

提交回复
热议问题