In my C# script, I make this button when the page loads.

```
    Button b = new Button();
    b.OnClientClick = "Edit_Button_Click(sender,e);";

```

The 'Edit\_Button\_Click(object sender, EventArgs e)' function looks like this...

```
    protected void Edit_Button_Click(object sender, EventArgs e)
{
    Button btnSomeButton = sender as Button;
    btnSomeButton.Text = "I was clicked!";
}

```

But, when I click the button on the web form, before the code even gets to that function, I get an error that says '0x800a1391 - JavaScript runtime error: 'Edit\_Button\_Click' is undefined'.
This is confusing to me because I didn't expect any JavaScript errors while I was writing my scripts in C#. I am new to designing webforms, so correct me if I'm wrong, but I don't think I should be seeing anything related to JavaScript since the page language is in C#.

```
    <script runat = "server>

    protected void Page_Load(object sender, EventArgs e)
    {
    Button b = new Button();
            b.Text = "EDIT";
            b.ID = r.ID + "edit button";
            b.OnClick += Edit_Button_Click(sender, e);
    }

    protected void Edit_Button_Click(object sender, EventArgs e)
    {
        Button btnSomeButton = sender as Button;
        btnSomeButton.Text = "I was clicked!";
    }

    </script>

```