Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling javascript Method from Code behind using ScriptManager.RegisterStartupScript

I am using Ajax Toolkit on my content page . I have an Javascript Code which i want to call from the code behind using ScriptManager.RegisterStartupScript.

The javaScript Code is :-

<script type="text/javascript">
   function disp_confirm() {
       var r = jConfirm("Your Shift End ! Do you still want to Continue ? ")
       if (r == true) {
           jAlert("You pressed OK!")
       }
       else {
           jAlert("You pressed Cancel!")
       }

How to call this disp_confirm()method of javascript from the code behind using C# .

like image 298
Dharmendra Kumar Singh Avatar asked Mar 25 '26 16:03

Dharmendra Kumar Singh


1 Answers

Try this

ScriptManager.RegisterStartupScript(Page,GetType(),"disp_confirm","<script>disp_confirm()</script>",false)
like image 122
Rajneesh Avatar answered Mar 28 '26 04:03

Rajneesh



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!