How to jQuery function to register (call) from asp.net usercontrol from codebehind file?

How to jQuery function to register (call) from asp.net usercontrol from codebehind file?

+2
source share
1 answer

You can use ClientScriptManager.RegisterStartupScript() , for example:

 var script = "$(function() { $('#message').fadeIn(); });"; Page.ClientScript.RegisterStartupScript(GetType(), "keyHere", script, true); 

This is displayed on the page as follows:

 <script type="text/javascript"> $(function() { $('#message').fadeIn(); }); </script> 

A script is just any JavaScript, nothing special in jQuery, just enter everything you manually placed on the page there, as it ends.

+4
source

Source: https://habr.com/ru/post/1345589/


All Articles