Ajax 和 ASP.NET MasterPages 可以混合使用吗?
有人有同时使用这两种技术的经验吗? 让两者合作的主要困难是什么(如果有的话)? 使用这些技术的站点与使用 Ajax 的普通 ASP.NET Web 应用程序有何不同?
谢谢!
Has anyone had experience using these two technologies in tandem? What are (if any) the major difficulties in getting the two to cooperate? How would a site using these technologies be different than a normal ASP.NET Web Application with Ajax?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,他们合作得很好。
唯一需要注意的是,如果您在 Master 上有 ScriptManager,则不能在内容页面中声明另一个。
如果您想通过内容页面上的 ScriptManager 注册脚本和服务,则需要使用 ScriptManagerProxy 控件。 它是专门为主/内容场景设计的控件。
Yes, they work well together.
The only thing to watch out for is if you have a ScriptManager on the Master, you can't declare another in Content pages.
If you want to register scripts and services through the ScriptManager on Content pages, you'll need to use a ScriptManagerProxy control instead. It's a control specifically designed for the Master/Content scenario.
我已经将母版页和 ASP.NET AJAX 一起使用,没有出现任何问题。 您可以在内容占位符上使用脚本管理器,也可以在母版页中使用单个脚本管理器,但您必须记住在内容区域中使用 ScriptManagerProxy 以获得正确的功能。
I've used Master Pages and ASP.NET AJAX together without issues. You can either use the script manager on your content placeholders or use a single scriptmanager in your master page, but then you have to remember to use the ScriptManagerProxy in the content areas to get the proper functionality.
这取决于您所谈论的 Ajax 框架,对于 ASP.NET AJAX,您需要使用 ScriptManager(Proxy),这会使它变得有点复杂,但并不是那么困难......
Ra- 的示例 Ajax 大多都使用 MasterPages,而不需要摆弄 ScriptManager 或 ScriptManagerProxy。 但是 Ra-Ajax 构建在与 ASP.NET AJAX 完全不同的架构之上...
顺便说一句,我使用 Ra-Ajax,很难将其定义为“中立”...
IT depends on what Ajax Framework you're talking about, for ASP.NET AJAX you need to mess around with ScriptManager(Proxy) which complicates it a little bit, but not so that it's very difficult...
The samples of Ra-Ajax are mostly all using MasterPages, without the needs to fiddle around with ScriptManager or ScriptManagerProxy. But Ra-Ajax builds on a completely different architecture then ASP.NET AJAX...
BTW, I work with Ra-Ajax and can hardly be defined as "neutral"...
除了在母版页上声明 ScriptManager 和在内容页上声明 ScriptManagerProxy 之外,最好的做法是将所有 JavaScript 文件放在单独的 dll 中,以便将所有资源与项目的其余部分分开。 拥有单独的 Javascript 文件的调试版本和发布版本(删除了空格)可为您带来良好的性能提升。
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.