gpt4 book ai didi

c# - 如何在 c# 中单击按钮时显示 iframe,并在显示另一个网格或 iframe 时使其不可见?

转载 作者:行者123 更新时间:2023-11-28 01:16:47 24 4
gpt4 key购买 nike

我正在 visual studio 10 中使用 asp.net/c# 构建数据库驱动的 Web 应用程序(实际上这是我的第一个,所以我希望这个问题不是愚蠢之类的)我应该在后面的代码中的 Button_Click 事件中编写什么代码,以便在单击按钮时显示 iframe 并在加载另一个对象时隐藏(对于例如 Gridview)?我在任何其他答案中都找不到任何匹配的脚本。这是 iframe 的代码:

<asp:Panel>


//...some code about gridviews and dropdownlists....//


<div id ="Frame" class="iframe">

<iframe name="iframe" id="iframe1" src="AddProject.aspx" class="iframe>

</iframe>

</div>

</asp:Panel>

<asp:Button ID="Button1" runat="server" Text="Add Project" Width="127px"/>

最佳答案

您需要在您的 div 中设置 runat 属性以使其工作

<div id="Frame" runat="server">

你可以隐藏第i帧所在的div

在您的按钮点击事件中,您放置:
Frame.Visible = true;//显示 div

Frame.Visible = false;//隐藏 div

这也适用于 iframe 本身

这你也可以在像 gridview .ect 这样的控件上使用

 GridView1.Visible = true;
GridView1.Visible = false;

关于c# - 如何在 c# 中单击按钮时显示 iframe,并在显示另一个网格或 iframe 时使其不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35445549/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com