title: How to run javascript from c# in asp.net
body: <p>I am new to Asp.Net and i have my aspx page like this</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="TestJs.aspx.cs" Inherits="tms.Test.TestJs" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="StyleSection" runat="server"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentSection" runat="server"&gt;
      &lt;div class="container"&gt;
          &lt;div class="panel"&gt;
              &lt;asp:Button ID="btnAlert" OnClick="btnAlert_OnClick" runat="server"/&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content3" ContentPlaceHolderID="ScriptSection" runat="server"&gt;
      &lt;script type="text/javascript"&gt;
          function myFunc() {
              $.alert("Hello Mz");
          }
      &lt;/script&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>And my .cs file looks like this</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  namespace tms.Test
  {
      public partial class TestJs : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
  
          }
  
          protected void btnAlert_OnClick(object sender, EventArgs e)
          {
              ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "newFunc", "myFunc()", true);
          }
      }
  }
  </code></pre>
  
  <p>When I click the button the script does not call up and give some object expected error.</p>
  
  <p>I am really stuck at this. Please help me. 
  Thanx In Advance.</p>