I have declared a button in my CreateChildControls method in my web part page:
TableCell updateCell = new TableCell();
Update = new Button();
Update.Text = "Update";
Update.OnClientClick += new EventHandler(Update_OnClick);
updateCell.Controls.Add(Update);
ButtonRow.Controls.Add(updateCell);
This is the eventhandler that I created:
private void Update_OnClick(object sender, EventArgs e)
{
if (_TYPE == "FIXED")
{
Item["Retail"] = txtFixedRetail.Text;
Item.Update();
EmailFixedAlert();
}
}
However JScript throws an error:
Microsoft JScript runtime error: 'System' is undefined
And produces this in the HTML:
<td><input type="submit" name="ctl00$m$g_c260f907_31c1_436b_b99e_9bf79427625c$ctl11" value="Update" onclick="System.EventHandler;" /></td>
Why is the eventhandler that I declared in the WebPart not passing to the Page? Do I have to push all events to the Client?