I am using the code:
ClientScript.RegisterStartupScript(typeof(Page), "message", message);
This code works fine in an ASP.NET page but does not in a UserControl. I need to use this functionality in UserControl.
You could try:
string script = "<script language='JavaScript'>alert('hello');</script>";
Page.RegisterStartupScript("myscript", script);
or
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", "<script>alert('Hello.')</script>", false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With