How to call javascript function from code-behind

I wrote a javascript with a page.

In Page

     <script type="text/javascript">
      function Myfunction(){
<input type="text" id="MyText" runat="server" /> </BODY>

In Code-behind

 Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  Handles Me.Load
       If Session("My")= "Hi" Then
          I want to call "Myfunction" javascript function
       End If 
 End Sub

How can I do?


This is a way to invoke one or more JavaScript methods from the code behind. By using Script Manager we can call the methods in sequence. Consider the below code for example.

ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", 
    alert('Overrides successfully Updated.');

In this first method EnableControls() is invoked. Next the alert will be displayed. Next the DisableControls() method will be invoked.