I am dynamically generating Linkbuttons on a page depending on how many rows pulled from a datatable. The problem is when i click the button nothng happens.
I belive it is because when the page postbacks the buttons need to be created again, but I am not sure how to do this as the linkbuttons are generated from the datatable.
LinkButton lnkbtn = new LinkButton();
lnkbtn.ID = "Home_" + (Count);
lnkbtn.Text = HomeTeamName;
lnkbtn.CommandArgument = homesupCID;
lnkbtn.CommandName = "ViewScores";
lnkbtn.EnableViewState = true;
lnkbtn.Command += new CommandEventHandler(LinkButton_Command);
void LinkButton_Command(object sender, CommandEventArgs e)
var lb = (LinkButton)sender;
Open in new window
HomeTeamName, homesupCID are populated from the databable, there is other data from the datatable used for other things inside the function.
How do i get this to work ?