在的iFrame的UpdatePanel不更新

编程入门 行业动态 更新时间:2024-10-28 15:33:23
本文介绍了在的iFrame的UpdatePanel不更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想,当点击页面上的按钮来更新一个iFrame的来源。然而,似乎没有任何要发生的事情...

I'm trying to update the source of an iFrame when a button is clicked on the page. However, nothing seems to be happening...

.ASPX:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"> <ContentTemplate> <div class="accountInfo"> <p class="submitButton"> <asp:Button ID="ValidateButton" runat="server" Text="Validate" OnClick="SubmitSponsor" /> </p> </div> <iframe runat="server" id="PayPalFrame" height="150px" width="100%" frameborder="0"></iframe> </ContentTemplate> </asp:UpdatePanel>

code背后:

protected void SubmitSponsor(object sender, EventArgs e) { var driver = new Driver(); var isvalid = driver.IsAppValid(URL.Text, APILINK, Connstring); if (isvalid) { PayPalFrame.Attributes.Add("src", "www.google"); URLInvalid.Visible = false; } }

我也试过: PayPalFrame.Attributes [SRC] =htt​​p://www.google; ,仍然一无所获。

推荐答案

我已经测试了code,它在一个样本项目如下:

I have tested your code, and it works in a sample project:

ASPX:

<form id="form1" runat="server"> <div> <asp:ScriptManager runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"> <ContentTemplate> <div class="accountInfo"> <p class="submitButton"> <asp:Button ID="ValidateButton" runat="server" Text="Validate" OnClick="SubmitSponsor" /> </p> </div> <iframe runat="server" id="PayPalFrame" height="150px" width="100%" frameborder="0"> </iframe> </ContentTemplate> </asp:UpdatePanel> </div> </form>

codebehind:

Codebehind:

public partial class UpdatePanelIFrameTester : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void SubmitSponsor(object sender, EventArgs e) { bool isvalid = true; if (isvalid) { PayPalFrame.Attributes.Add("src", "www.ironworks"); } } }

我要检查你的code和确保没有导致网页刷新/执行完全回发(我改变谷歌将不会让你在标准条件下的iframe中查看它的URL)。

I would inspect your code and ensure nothing is causing your page to refresh/perform a full postback (I changed the URL as google will not allow you to view it in an iframe under standard conditions).

更多推荐

在的iFrame的UpdatePanel不更新

本文发布于:2023-11-25 00:16:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627511.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iFrame   UpdatePanel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!