MasterPage 中的 ModalPopupExtender 和 DynamicPopulateExtender
我读到,将 ModalPopups 和 DynamicPopulates 放在 Site.master 中并不是一个好主意(或者根本不可能)。但是,如果我想在页眉/页脚中添加一个链接来打开一个弹出窗口,通过 DynamicPopulate 加载信息,那么如何实现呢?
我看到评论告诉人们创建一个 Web 用户控件,我也这样做了,但我得到了与没有额外的自定义用户控件时相同的错误:“Web 服务调用失败:500”。我不认为这是我的 webmethod 的错误:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string LoadPageToBeLoaded(string contextKey)
{
return "hello";
}
将调用此代码的对象放在母版页之外的任何地方都会产生我想要的结果,但缺少将代码复制粘贴到底部的所有页面中(这就是单个页面的内容)页脚无论如何都是为了,对吧?)我不知道如何解决这个问题。
谢谢。
编辑:我发现用户控件中不允许使用 webmethods,因此解决了该问题。但似乎仍然应该有一种简单的方法来打开模式弹出窗口,并通过网站页眉或页脚中的动态填充将信息加载到其中。
I have read that it is not a good idea (or just straight not possible) to put ModalPopups and DynamicPopulates in Site.master. However, if I wanted to have a link in the header/footer that opened up a popup which loaded information via a DynamicPopulate, how would that be accomplished?
I've seen comments telling people to make a web user control which I did but I get the same error I got without the extra custom user control: "Web service call failed: 500". I don't think it is an error with my webmethod:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string LoadPageToBeLoaded(string contextKey)
{
return "hello";
}
Putting the objects that call this code anywhere but the masterpage yields the results I want but short of copy-pasting the code into all of the pages at the bottom (that's what the single footer is for anyway, right?) I'm not sure how to approach this.
Thanks.
EDIT: I've found out that webmethods are not allowed in user controls, so that solves that issue. But it still seems like there should be a simple way to open a modal popup and load information into it with a dynamic populate in the header or footer of a site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论