ASP.NET Ajax 和ModalPopupExtender 不显示

发布于 2024-09-19 15:15:52 字数 1215 浏览 5 评论 0原文

我无法使用 ModalPopupExtender 获取面板弹出窗口。 这是代码

.modalBackground
{
  background-color:#CCCCFF;
  filter:alpha(opacity=40);
  display:none;
  opacity:0.5;
}
.ModalWindow
{
  border: solid1px#c0c0c0;
  background:#f0f0f0;
  padding: 0px 10px 10px 10px;
  position:absolute;
  top:-1000px;
  left:-1000;
}

代码:

<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="modalBackground">
            Content goes here
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
        </asp:Panel>
        <asp:LinkButton runat="server" ID="btnPopup" Text="pop" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" RepositionMode="RepositionOnWindowResize"
            TargetControlID="btnPopup" PopupControlID="panEdit" BackgroundCssClass="modalBackground"
            CancelControlID="btnCancel">
        </asp:ModalPopupExtender>
    </ContentTemplate>
</asp:UpdatePanel>

当我单击 btnPopup 时,没有任何反应。 有什么想法吗?

I'm not able to get my panel popup using ModalPopupExtender.
Here's the code

.modalBackground
{
  background-color:#CCCCFF;
  filter:alpha(opacity=40);
  display:none;
  opacity:0.5;
}
.ModalWindow
{
  border: solid1px#c0c0c0;
  background:#f0f0f0;
  padding: 0px 10px 10px 10px;
  position:absolute;
  top:-1000px;
  left:-1000;
}

And the code:

<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="modalBackground">
            Content goes here
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
        </asp:Panel>
        <asp:LinkButton runat="server" ID="btnPopup" Text="pop" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" RepositionMode="RepositionOnWindowResize"
            TargetControlID="btnPopup" PopupControlID="panEdit" BackgroundCssClass="modalBackground"
            CancelControlID="btnCancel">
        </asp:ModalPopupExtender>
    </ContentTemplate>
</asp:UpdatePanel>

When I click btnPopup, nothing happens.
Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你丑哭了我 2024-09-26 15:15:52

可能来不及提供帮助,但如果其他人偶然发现这一点,我很确定答案是替换:


您的弹出窗口未从正确的 js 集中获取行为。安装 AjaxControlToolkit 后,ToolkitScriptManager 就可用了。不幸的是,这个小旁注没有包含在分步安装说明中。

还有一件事。将 -1000; 替换为 -1000px;

probably too late to help, but if anyone else stumbles upon this, I'm pretty sure the answer is to replace:
<asp:ScriptManager runat="server"></asp:ScriptManager>
with
<asp:ToolkitScriptManager ID="whatever" runat="server">

your popup isn't getting the behaviors from the right js set. once you've installed the AjaxControlToolkit, the ToolkitScriptManager is available. this little side note is unfortunately not included in the step-by-step installation instructions.

one more thing. replace -1000; with -1000px;

妄司 2024-09-26 15:15:52

你从哪里得到这个代码?
通过 css 上的这个参数,我认为您不会看到模态。

 top:-1000px;
 left:-1000;

无论如何,我认为你必须遵循 MS 给出的示例,然后复制/粘贴并处理该示例。这个例子跟你的完全不一样。

http://www.asp.net/ajaxlibrary/download.ashx 然后搜索 ModalPopUp 的示例

Where did you get this code ?
With this parameters on css I do not think that you ever see a modal.

 top:-1000px;
 left:-1000;

Anyway I think that you must follow the example that give by MS and just copy/paste and work on that example. The example is totally different from you.

get the sdk from http://www.asp.net/ajaxlibrary/download.ashx and then search on the examples for the ModalPopUp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文