Fancybox - ASP.NET OnLoad
I want Fancybox to work without a click, but instead open automatically on load.
I tried this but it doesn't work:
content .cs
protected void Page_Load(object sender, EventArgs e)
{
Presenter.InitializeView(this);
string myScript = "$('#divMessageBox').fa开发者_开发问答ncybox();";
ClientScript.RegisterStartupScript(typeof(Page), "alert", myScript, true);
}
content .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:
string myScript = "$('#myFancybox').fancybox();" //add options if needed
ClientScript.RegisterStartupScript(typeof(Page), "alert", script, true);
精彩评论