Recently I was asked the following questions in an interview:
- How will you do performance optimization over your jQuery in ASP.NET?
- How many script managers can you have in an ASP.NET application? Why? (AJAX related)
Could someone explain the answer to these questions? I have no idea about either of them.
You can only have one
ScriptManageron a page. The script manager has several responsibilities, such as loading the MS Ajax libraries, creating proxy classes for web services, and enabling partial page rendering (e.g.UpdatePanel) support. It doesn’t make sense to have more than one per page, and you’ll get an exception if you try to do this.If you need to load additional scripts or references, in a user control for example, you can use the
ScriptManagerProxyclass.