【问题标题】:To give usercontrol in src of iframe在 iframe 的 src 中赋予用户控制权
【发布时间】:2014-07-17 05:24:04
【问题描述】:

我有一个ModalPopupExtender 喜欢,

<ajaxtoolkit:ModalPopupExtender ID="mpeClientView" runat="server" TargetControlID="lblClientName" PopupControlID="frmMaodalPopup" OkControlID="closeBtn"></ajaxtoolkit:ModalPopupExtender>

还有一个iframe 喜欢

<iframe id="frmMaodalPopup" runat="server" src="/DashboardUserControls/ClientInformation.ascx" width="700px" height="400px" scrolling="no"></iframe>

还有一个LinkButton

<asp:LinkButton ID="lnkSearch1" runat="server" Enabled="true" OnClick="lnkSearch_Click" Text="Client Name"></asp:LinkButton>

当我单击 LinkBut​​ton 时,我希望 iframe 弹出哪个 src 是 UserControl ClientInformation.ascx。但是当我单击按钮时 iframe 弹出,但它无法加载用户控件。请指出我在哪里犯了错误

【问题讨论】:

  • 好吧,我建议,在单击按钮之前,检查 iframe 是否正在显示带有控件的页面。这样你就可以确定它是否正确加载。稍后您可以检查事件(按钮单击)。

标签: asp.net iframe modalpopupextender


【解决方案1】:

用户控件不能自行运行

您需要制作一个 aspx 页面,将此控件放在该页面内,然后将该页面加载到 iframe 上。

【讨论】:

  • 只是出于好奇,如果我将用户控件加载到一个 asp 面板中并使面板弹出它可以完美地工作。那么哪个更好,弹出包含用户控件的面板或弹出包含 aspx 页面的 iframe?
  • @Rain 这取决于此弹出窗口的作用、加载时间、调用频率、是否回发以及您喜欢留在页面上。例如,如果此对话框在回发后需要留在那里,请使用 iframe。如果没有并且加载速度很快,那么您可以避免再加载一页......由您决定什么对您的页面更好。 iframe 是在调用时加载,另一种方式是提前加载。
猜你喜欢
  • 2020-04-18
  • 1970-01-01
  • 2015-10-06
  • 2016-06-05
  • 1970-01-01
  • 2021-07-26
  • 1970-01-01
  • 1970-01-01
  • 2020-08-11
相关资源
最近更新 更多