Programmatically assigned eventhandler not showing up in HTML onClick attribute
<p>I'm currently having a problem with event handlers assigned in the code-behind not appearing in the HTML code of the .aspx page. Below is the code fragment that does that:</p>

<pre><code>HtmlTable table = new HtmlTable();
HtmlTableRow row = new HtmlTableRow();

foreach(XmlNode item in IDList)
{
    LinkButton btn = new LinkButton();
    btn.Text = item.InnerText;
    btn.Click += new EventHandler(btn_Click);

    HtmlTableCell cell = new HtmlTableCell();
    cell.Controls.add(btn);
    row.cells.add(cell);
}

table.rows.add(row);
</code></pre>

<p>Something like that, more or less. So when I run the page and inspected the buttons using FireBug, I noticed that the eventhandler names for the buttons created have been changed to the LinkButtons' unique ID(ct125, 126, 127, etc), I think, and not "btn_Click"</p>

<p>I'm hoping to hear if anyone else has faced this problem before and found a solution for it. Thanks.</p>
