jquery span button saying "Button1_Click is not defined"
<pre><code>using Visual.Web.Developer.2010.Express;
using SQL.Server.Management.Studios.R2.Express;
</code></pre>

<p>What I'm trying to do, is get a button to run some C# when a button is clicked.. Sounds simple, right?.. I'm stuck at this part.<br><br>
I have a span (Jquery UI button) being created when the user keypress's in an HTML input. As soon as they click the span, it saves what the user inputed and sends it to the database... Well, not quite yet. I'm building this and I'm stuck at this part.</p>

<p>One would attach the button click via attribute in the span tag, correct?<br></p>

<pre><code>&lt;span class="ui-state-default ui-corner-all ui-icon-disk ui-icon saveButton" title="Save" style="float:left" onclick="Button1_Click"&gt;&lt;/span&gt;
</code></pre>

<p><br><br></p>

<p><em>C#</em><br></p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
    Console.WriteLine("Hello World");
}
</code></pre>

<p><br><br>Looks pretty simple, right? When I run this in debug, Firebug reads "Button1_Click is not defined"<br>
.<br>.<br>.<br>
Give me some insight here please!<br><br>
<em>My HTML/Javascript code</em><br><br></p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function () {

        $('.hexen').after('&lt;span class="ui-state-default ui-corner-all ui-icon-disk ui-icon saveButton" title="Save" style="float:left" onclick="Button1_Click"&gt;&lt;/span&gt;')// ui icon

    .keypress(function () {
        $(this).next('.saveButton').show();
    }); //adds ui icon

        $('.ui-state-default').hover(
    function () {
        $(this).addClass('ui-state-hover');
    }, function () {
        $(this).removeClass('ui-state-hover');
    }); //ui icon hover

        $('.saveButton').click(function () {
            var id = $(this).prev().attr('id'); //used in the "data" attribute of the ajax call
            var value = $(this).prev().val(); //used in the "data" attribute of the ajax call

            $.ajax({
                type: "POST",
                url: "Default.aspx",
                data: "{Id: " + id + ", Value: " + value + "}",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    console.log(data);
                }
            });
            $(this).hide();
        }); //runs ajax call and removes ui-icon after .saveButton is clicked

    }); //end .ready
&lt;/script&gt; 

&lt;input type="text" class="hexen" id="investigate1"/&gt;&lt;br /&gt;
&lt;input type="text" class="hexen" id="investigate2"/&gt;&lt;br /&gt;
&lt;input type="text" class="hexen" id="investigate3"/&gt;&lt;br /&gt;
&lt;input type="text" class="hexen" id="investigate4"/&gt;&lt;br /&gt;
&lt;input type="text" class="hexen" id="investigate5"/&gt;
</code></pre>

<p><br><br>
Thanks in advance!</p>
