I have a Javascript block on my asp.net page:
<script type="text/javascript">
Sys.debug = true;
var popup;
Sys.require(Sys.components.popup, function () {
popup = Sys.create.popup("#popup", {
parentElementID: "target",
});
});
</script>
How do I call this from C# code behind?
ClientScript.RegisterStartupScript(GetType(), "key", ???, true);
Try this:
ClientScript.RegisterStartupScript(this.GetType(), "sample", "<script
type="text/javascript">Sys.debug = true;var popup;Sys.require(Sys.components.popup,
function () {popup = Sys.create.popup("#popup", {parentElementID: "target",});});
</script>",false);
One way to call :
Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "xyz();", true); Keep your JavaScript in a function ;
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.