ASP.NET Ajax 和ModalPopupExtender 不显示
我无法使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能来不及提供帮助,但如果其他人偶然发现这一点,我很确定答案是替换:
和
您的弹出窗口未从正确的 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;
你从哪里得到这个代码?
通过 css 上的这个参数,我认为您不会看到模态。
无论如何,我认为你必须遵循 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.
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