我的ModalPopup应用程序中有一个asp.net窗口,在单击Listview控件项时要显示该窗口。
<div id="ModalPopup" style="visibility:hidden" runat="server">
<div style="position: absolute; width: 100%; height: 100%; z-index: 10002; background-color: Gray; filter: alpha(opacity=70); opacity: 0.7;">
</div>
<table style="position: absolute; width: 100%; height: 100%; z-index: 10003;">
<tr>
<td align="center" valign="middle">
<div style="color: Black; font-weight: bolder; background-color: White; padding: 15px; width: 200px;">
<asp:Image ID="Image4" runat="server" ImageUrl="~/Images/ajax-loader.gif" />...Processing....
</div>
</td>
</tr>
</table>
</div> 但是,在我的RadListView1_SelectedIndexChanged事件中,我的代码是:ModalPopup.Attributes.Add("style", "visibility:visible");,但是模式弹出不显示。
当选择ListView项时,如何显示它?
发布于 2013-03-05 23:33:52
由于您已经将ModalPopup div定义为服务器控件(例如runat=server)、和,所以您试图决定是否在代码隐藏中显示它--只需使用Visible属性.
<div id="ModalPopup" Visible="false" runat="server">
....
</div>在您的RadListView1_SelectedIndexChanged事件中,在后面的代码中,只需更改为true:
protected void RadListView1_SelectedIndexChanged()
{
ModalPopup.Visible = true;
}如果您坚持要更改可见性属性本身,可以这样使用RegisterStartupScript:
protected void RadListView1_SelectedIndexChanged()
{
ClientScript.RegisterStartupScript(this.GetType(), "ShowPopup", "document.getElementById('" + ModalPopup.ClientID + "').style.visibility = 'visible';", true);
}https://stackoverflow.com/questions/15234822
复制相似问题