有没有人有过同时使用这两种技术的经验?让两者合作的主要困难是什么(如果有的话)?使用这些技术的站点与使用 Ajax 的普通 ASP.NET Web 应用程序有何不同?
谢谢!
有没有人有过同时使用这两种技术的经验?让两者合作的主要困难是什么(如果有的话)?使用这些技术的站点与使用 Ajax 的普通 ASP.NET Web 应用程序有何不同?
谢谢!
是的,他们一起工作得很好。
唯一需要注意的是,如果您在 Master 上有一个 ScriptManager,则不能在内容页面中声明另一个。
如果您想通过内容页面上的 ScriptManager 注册脚本和服务,则需要使用ScriptManagerProxy控件。它是专为 Master/Content 场景设计的控件。
我一起使用母版页和 ASP.NET AJAX 没有问题。您可以在内容占位符上使用脚本管理器,也可以在母版页中使用单个脚本管理器,但是您必须记住在内容区域中使用 ScriptManagerProxy 以获得正确的功能。
In addition to declaring the ScriptManager on the Master Page and ScriptManagerProxy on the content pages, it is a good practice to put all the JavaScript files in a separate dll so you have all your resources separate from the rest of the project. Having separate debug and release versions (with white spaces removed) of the Javascript files gives you a good performance boost.