Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call javascript's function from code behind

I use below code for call javascript's function from code behind but doesn't call function

//C#
Page.ClientScript.RegisterStartupScript(this.GetType(), "close panel", "CloseFunction()", true);

//javascript
function CloseFunction() {
            alert("call");
            }

1 Answers

It should be true.

Page.ClientScript.RegisterStartupScript(this.GetType(), "close panel", "CloseFunction()", 
true);

Update Link:

ClientScriptManager.RegisterStartupScript Method

a Boolean value indicating whether to add script tags.

like image 132
Win Avatar answered Sep 14 '26 10:09

Win



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!