This is what I got on my user control..
//programatically add a link button
LinkButton LB1 = new LinkButton();
LB1.CommandName = "Products";
LB1.CommandArgument = "something";
LB1.Command += new System.Web.UI.WebControls.CommandEventHandler(OnLinkClick);
void OnLinkClick(object O, System.Web.UI.WebControls.CommandEventArgs E)
//do something here.
The "Build_datagrid" function will be called from another web page.
The link button gets built fine. But when I click on link button LB1, it does not fire off the "OnLinkClick" function..
What am I missing here?
Should I add the CommandEventHandler code outside the "Build_datagrid" function?