jQuery $(document).ready and UpdatePanels?

后端 未结 19 1751
庸人自扰
庸人自扰 2020-11-22 01:32

I\'m using jQuery to wire up some mouseover effects on elements that are inside an UpdatePanel. The events are bound in $(document).ready . For example:

19条回答
  •  独厮守ぢ
    2020-11-22 01:54

    User Control with jQuery Inside an UpdatePanel

    This isn't a direct answer to the question, but I did put this solution together by reading the answers that I found here, and I thought someone might find it useful.

    I was trying to use a jQuery textarea limiter inside of a User Control. This was tricky, because the User Control runs inside of an UpdatePanel, and it was losing its bindings on callback.

    If this was just a page, the answers here would have applied directly. However, User Controls do not have direct access to the head tag, nor did they have direct access to the UpdatePanel as some of the answers assume.

    I ended up putting this script block right into the top of my User Control's markup. For the initial bind, it uses $(document).ready, and then it uses prm.add_endRequest from there:

    
    

    So... Just thought someone might like to know that this works.

提交回复
热议问题