Running a C# and a Javascript function on an asp button control?
<p>I can get both the Javascript and the C# function to work just fine. </p>

<p>However, my Javascript function runs before the C#.</p>

<p>How do I get it to run after the C# function??</p>

<p>Here is my code:</p>

<pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;

&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt;
&lt;ContentTemplate&gt;
&lt;asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"&gt;
&lt;asp:View ID="View1" runat="server"&gt;
&lt;div id="div2" style="height:70px; width:auto; text-align:center;"&gt;
&lt;p&gt;&lt;b&gt;This is A View!!!&lt;/b&gt;&lt;/p&gt;
  &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
&lt;/div&gt;

&lt;div id="div1"&gt;
    &lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" 
        OnClientClick="javascript:Highlit()" /&gt;
&lt;/div&gt;
&lt;/asp:View&gt;
&lt;/asp:MultiView&gt;

&lt;script type="text/javascript"&gt;

function Highlit() 
{
 $("#div2").effect("highlight", {}, 10000);
}
&lt;/script&gt;

 &lt;/ContentTemplate&gt;
 &lt;/asp:UpdatePanel&gt;
</code></pre>

<p><strong>Code behind:</strong></p>

<pre><code>namespace jQuery_Highlight.jQuery_Highlight
{
public partial class jQuery_HighlightUserControl : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Changed";
    }
   }
}
</code></pre>

<p>Here is the code reflecting changes from the answers:</p>

<p><strong>Code behind</strong></p>

<pre><code>namespace jQuery_Highlight.jQuery_Highlight
{
public partial class jQuery_HighlightUserControl : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Changed";
        ScriptManager.RegisterStartupScript(this, this.GetType(), "TEST", "Highlit();", true);
    }
   }
   }




 &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;

 &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt;
 &lt;ContentTemplate&gt;
 &lt;asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"&gt;
 &lt;asp:View ID="View1" runat="server"&gt;
 &lt;div id="div2" style="height:70px; width:auto; text-align:center;"&gt;
 &lt;p&gt;&lt;b&gt;This is A View!!!&lt;/b&gt;&lt;/p&gt;
 &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
 &lt;/div&gt;

 &lt;div id="div1"&gt;
  &lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /&gt;
 &lt;/div&gt;
 &lt;/asp:View&gt;
 &lt;/asp:MultiView&gt;

 &lt;/ContentTemplate&gt;
 &lt;/asp:UpdatePanel&gt;

&lt;script type="text/javascript"&gt;

function Highlit() {
    $("#div2").effect("highlight", { color: "#9499FC" }, 10000);
}
&lt;/script&gt;
</code></pre>
