[英]Fancybox - ASP.NET OnLoad
I want Fancybox to work without a click, but instead open automatically on load. 我希望Fancybox无需单击即可工作,而是在加载时自动打开。
I tried this but it doesn't work: 我试过了,但是没有用:
content .cs 内容.cs
protected void Page_Load(object sender, EventArgs e)
{
Presenter.InitializeView(this);
string myScript = "$('#divMessageBox').fancybox();";
ClientScript.RegisterStartupScript(typeof(Page), "alert", myScript, true);
}
content .aspx 内容.aspx
<div id="divMessageBox" style="width:400px;height:100px;overflow:auto;">
<asp:Label ID="lblMessage" runat="server" Text="testando Fancybox" />
</div>
You can register it to run when the page loads using RegisterStartupScript()
, like this: 您可以使用RegisterStartupScript()
将其RegisterStartupScript()
在页面加载时运行,如下所示:
string myScript = "$('#myFancybox').fancybox();" //add options if needed
ClientScript.RegisterStartupScript(typeof(Page), "alert", script, true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.