本文介绍了需要调用jQuery(window).load(function())使用c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用C#调用(window).load(function())
。
I need to call the (window).load(function ())
using C#. Is there anyway that I could accomplish this.
推荐答案
注册任何你想要的脚本:
Register whatever script you want with RegisterStartupScript
:
protected void Page_Load(object sender, EventArgs e)
{
// Define the name and type of the client scripts on the page.
String csname1 = "PopupScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname1))
{
StringBuilder cstext1 = new StringBuilder();
cstext1.Append(@"$(document).ready(function() {
// Handler for .ready() called.
});");
cs.RegisterStartupScript(cstype, csname1, cstext1.ToString(), true);
}
}
这篇关于需要调用jQuery(window).load(function())使用c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!