ASP.Net:在 ModalPopupExtander 中从 iframe 控制 MainPage
我有一个页面“Default.aspx”。 在此页面中是一个带有 iFrame 的 ModalPopupControl:
<div style="float: right; margin-right: 10px; margin-top: 8px;">
<asp:Button ID="btnSearchGo" runat="server" Text="Jetzt suchen" OnClick="btnSearchGo_Click" />
</div>
<asp:ModalPopupExtender BackgroundCssClass="ModalPopupBG" OkControlID="linkClosestartSeach"
PopupDragHandleControlID="PopupHeader" ID="mpeMiniSearch" runat="server" TargetControlID="linkFooterImpressum"
PopupControlID="panMiniSearch">
</asp:ModalPopupExtender>
<asp:Panel Style="display: none" ID="panMiniSearch" runat="server">
<div class="HellowWorldPopup">
<div class="PopupHeader" id="Div10">
Suche</div>
<div class="PopupBody">
<iframe id="iFrameMiniSearch" runat="server" src="MiniSearch.aspx" class="iFramePopUp">
</iframe>
</div>
<div class="popupFooter">
<asp:LinkButton Text="Schließen" class="linkPupopClose" runat="server" ID="linkClosestartSeach"></asp:LinkButton>
</div>
</div>
</asp:Panel>
protected void btnSearchGo_Click(object sender, EventArgs e)
{
iFrameMiniSearch.Attributes["src"] = "MiniSearch.aspx";
//Do More
mpeMiniSearch.Show();
}
现在,我在 iFrame 中有一个 LinkButton,它应该关闭 MPE 并将页面 Default.aspx 重定向到 Register.aspx。
知道怎么做吗?
I have a page "Default.aspx".
In this page is a ModalPopupControl with an iFrame:
<div style="float: right; margin-right: 10px; margin-top: 8px;">
<asp:Button ID="btnSearchGo" runat="server" Text="Jetzt suchen" OnClick="btnSearchGo_Click" />
</div>
<asp:ModalPopupExtender BackgroundCssClass="ModalPopupBG" OkControlID="linkClosestartSeach"
PopupDragHandleControlID="PopupHeader" ID="mpeMiniSearch" runat="server" TargetControlID="linkFooterImpressum"
PopupControlID="panMiniSearch">
</asp:ModalPopupExtender>
<asp:Panel Style="display: none" ID="panMiniSearch" runat="server">
<div class="HellowWorldPopup">
<div class="PopupHeader" id="Div10">
Suche</div>
<div class="PopupBody">
<iframe id="iFrameMiniSearch" runat="server" src="MiniSearch.aspx" class="iFramePopUp">
</iframe>
</div>
<div class="popupFooter">
<asp:LinkButton Text="Schließen" class="linkPupopClose" runat="server" ID="linkClosestartSeach"></asp:LinkButton>
</div>
</div>
</asp:Panel>
protected void btnSearchGo_Click(object sender, EventArgs e)
{
iFrameMiniSearch.Attributes["src"] = "MiniSearch.aspx";
//Do More
mpeMiniSearch.Show();
}
Now I have a LinkButton in the iFrame that should close the MPE and redirect the Page Default.aspx to Register.aspx.
Any Idea how to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要为
ModalPopupExtender
指定一个BehaviorID
,以便您可以从客户端访问它。该属性默认为扩展程序的ClientID
,该属性会根据容器链的不同而有所不同,因此最好明确指定它:然后,您可以调用 $find() 来自
LinkButton
的 ClientClick 事件:First, you'll need to specify a
BehaviorID
for yourModalPopupExtender
, so you can access it from the client side. That property defaults to theClientID
of the extender, which will vary depending on the container chain, so it's best to specify it explicitly:Then, you can call $find() from your
LinkButton
's ClientClick event: