gpt4 book ai didi

c# - 回发后保持 css3 模式对话框打开

转载 作者:行者123 更新时间:2023-11-30 17:43:29 25 4
gpt4 key购买 nike

我有一个带有 gridview 的 CSS3 模态对话框,它将在进行搜索时填充。但是,当我去实际进行搜索(并因此导致回发)时,模式对话框关闭。如果我再次手动打开它,gridview 会按照我的需要进行填充。

我的问题是如何在搜索后的代码中保持模态对话框打开。任何帮助将不胜感激!

这是我的 CSS:

    .modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}

.modalDialog:target {
opacity:1;
pointer-events: auto;
}

.modalDialog > div {
width: 800px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
/*border-radius: 10px;*/
background: #fff;
/*background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);*/
}

.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}

.close:hover {
background: #00d9ff;
}

和 HTML:

<a href="#openModal">Open Modal</a>

<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>

<div>
<asp:Button ID="SearchBtn" runat="server"
OnClick="Search" Text="Search" />
<asp:GridView ID="gridview" GridLines="None"
AutoGenerateColumns="False" runat="server">
<Columns>
<asp:BoundField SortExpression="Name" DataField="Name"
HeaderText="Name" />
</Columns>
</asp:GridView>
</div>
</div>
</div>

最佳答案

如果您希望在搜索并使用值填充 gridview 后打开模式,请执行此操作。

gridview.DataBind();
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);

openModal 应该包含重新打开模态框所需的函数。

关于c# - 回发后保持 css3 模式对话框打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30855995/

25 4 0