Simple jQuery Hello World in ASPX
<p>I really dont understand why this simple example doesnt work :S
I have a WebApplication in which I have a script :</p>

<pre><code>function myAlert() {    
    $("#Button1").click(function () {
        alert("Hello world!");
    });
}
</code></pre>

<p>In my asp page, I have this simple code </p>

<pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Graph.aspx.cs" Inherits="WebApplication.Graph" %&gt;
&lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"&gt;  
&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
&lt;asp:Button ID="Button1" runat="server" Text="Button" Width="100px"/&gt;
&lt;/asp:Content&gt;
</code></pre>

<p>And finally I register the script in the cs :</p>

<pre><code>   protected override void OnPreLoad(EventArgs e)
   {
        Page.ClientScript.RegisterClientScriptInclude("jQuery",
                        ResolveUrl(@"Scripts\jquery-1.4.1.js"));
        Page.ClientScript.RegisterClientScriptInclude("jMyAlert",
            ResolveUrl(@"Scripts\MyAlert.js"));
        // check if the start up script is already registered with a key
        if(!Master.Page.ClientScript.IsStartupScriptRegistered("jMyAlert"))
        {
            // since it is not registered, register the script
            Master.Page.ClientScript.RegisterStartupScript
                (this.GetType(), "jMyAlert", "myAlert();", true);
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "jMyAlert", "myAlert()", true);
    }
</code></pre>

<p>I dont see what's wrong with this. I tried to include the scrit directly inside the aspx but nothing. I then try onto a simple html page and it works fine.</p>

<p>I want to use a plotting library using jQuery in my page so I'm very far to succeed if such a simple example causes me such a lot of problem...lol</p>
