How register (call) jQuery function from asp.net usercontrol from codebehind file?
1 Answer
You can use ClientScriptManager.RegisterStartupScript(), for example:
var script = "$(function() { $('#message').fadeIn(); });";
Page.ClientScript.RegisterStartupScript(GetType(), "keyHere", script, true);
This gets rendered to the page as:
<script type="text/javascript">
$(function() { $('#message').fadeIn(); });
</script>
The script is just any JavaScript, nothing special about jQuery, just put in there whatever you would manually put in the page, since that's how it ends up.
1 Comment
Nick Craver
@Bendar - Welcome! And welcome to SO! Be sure to accept answers, mingle with the natives and enjoy your stay :)