简体   繁体   中英

Why doesn't my JavaScript execute from my code behind?

Here is my aspx file: Default.aspx (I do not think this is relevant)

And here is my C# code-behind file: Default.aspx.cs

Here is my debug output. It shows that everything up to the JavaScript line gets executed:

[4476] aspx.page: Begin Load 
[4476] : Number of fields = 2 
[4476] : Page to load = Login 
[4476] : Session matched the supplied GUID! 
[4476] aspx.page: End Load 

I am totally lost. I'd really appreciate some help!

@Mike:如果您的页面中没有ScriptManager,则ScriptManager.RegisterClientScriptBlock方法将不起作用,请使用以下方法:

ClientScript.RegisterClientScriptBlock(this.GetType(), "DummeyKey", "alert('Hi')", true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM