在 MasterPage 内的 div 标签内使用 pagemethods 加载页面
我有一个 MasterPage ,它将出现在应用程序的每个页面中,并且我正在尝试加载一个“LoginBox”,它在该 MasterPage 的 Div 标记内使用 PageMethods
到目前为止,我已经尝试像在内容页面上那样做,尝试过将其转换为用户控件并尝试使用服务器端包含 () 没有一个成功。
我可以通过 firebug 看到网络资源已加载,但 PageMethods javascript 并未在任何这些方法中创建。
我真的试图避免必须为此创建一个WebService,并且移动LoginBox不是一个选项,我宁愿放弃MasterPage想法,但随后维护将变得地狱。
我需要这方面的想法或方向。 任何帮助表示赞赏
I have a MasterPage which will appear in every page in the application and I'm trying to load a "LoginBox" which uses PageMethods inside a Div tag in this MasterPage
So far I have tried doing as I would do on a Content Page, tried converting it into a User Control and tried using a server side include (< !--#include file="LoginBox.aspx"-->)
None succeeded.
I can see with firebug that the webresources get loaded but the PageMethods javascript isn't created in any of those methods.
I am REALLY trying to avoid having to create a WebService for this, and moving the LoginBox is not an option, I would rather drop the MasterPage idea, but then maintenance would become hell.
I need ideas or a direction on this.
Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用从 javascript 加载的 iframe 成功运行了它,对我来说这是一个丑陋的解决方案,但仍然是一个。我愿意寻求更好的解决方案
I got it working successfully with an iframe loaded from javascript, to me it's an ugly solution, but still one. I'm open for better solutions
在我看来,您正在将经典的 ASP 与 ASP.NET 混合在一起,
用户控件的要点是准确封装您在这里所做的事情。
但即便如此,您会发现尝试组件化代码仍然会导致混乱。如果可以的话,请考虑迁移到 ASP.NET MVC。这样你就可以做更合适、更干净的事情来保持你的代码库干净。
Looks to me like you're mashing classic asp with ASP.NET
the point of user controls is to encapsulate exactly what you are doing here.
even then however you will find your attempts to componentize your code will still lead to a messy mess mess. consider moving over to ASP.NET MVC if you can. with that you can do far more suitable and cleaner things to keep your codebase clean.