Hi,
I am trying to create a dynamicaly generated html table that has a column of linkbuttons. So far I have it working fine except for the linkbutton's eventhandlers. For some reason the method specified in the CommandName property of the linkbutton is not being called when the LinkButton is being called. I am using VS2005. In VS2003 I used to declare the eventhandlers in the initializecomponent method but I don't have access to that any more. Does anyone have any suggestions as to how I can get the LinkButtons' events registered
Thanks
Robert
Here is the code I am using...
public void CreateListTable(DataTable dt, Table tblList)
{
DataView dv = new DataView(dt);
tblList.CssClass = "LeftAlign";
TableCell tHCell2 = new TableCell();
tHCell2.Controls.Add(new LiteralControl("Name"));
tHr.Cells.Add(tHCell2);
tblList.Rows.Add(tHr);
foreach (DataRowView dr in dv)
{ TableCell tCell2 = new TableCell();
lbLink = new LinkButton();
lbLink.Text = dr["Name"].ToString();
lbLink.CommandName = "Choose";
lbLink.CommandArgument = dr["Num"].ToString();
lbLink.CssClass = "Link";
tCell2.Controls.Add(lbLink);
tr.Cells.Add(tCell2);
tblList.Rows.Add(tr);
}
tblList.Visible = true;
}
public void Choose(Object sender, EventArgs e)
{
//Code raised on linkbutton click here.
}

Linkbutton event handlers in Visual Studio 2005