Any downsides to using ASP.Net AJAX and JQuery together

前端 未结 9 1051
深忆病人
深忆病人 2021-02-04 10:41

We are planning to use the jQuery library to augment our client side JavaScript needs.

Are there any major issues in trying to use both ASP.Net AJAX and jQuery? Both li

9条回答
  •  遇见更好的自我
    2021-02-04 11:18

    One downside is that server side controls can get renamed, depending on their containers. For example, you might have:

    
    

    This may be rendered to the page as:

    So if you write jQuery using $('#panel1') as a selector, it won't work. The way around this is to generate the id dynamically, eg:

     Dim js as String = "$('" & panel1.ClientID & "').whatever();"
    

    This can make the javascript a bit unreadable, but it does work quite well. I work on a large web app using this method, and jQuery has saved us a TON of time, not to mention making the site look and work much better.

提交回复
热议问题