I am creating some link buttons dynamically and try to access them in some other functions in code behind but facing some problem
what i am doing is in the page load event
for (int i = 65; i <= 90; i++)
{
LinkButton lbtnCharacters = new LinkButton();
lbtnCharacters.Text = "<u>" + Char.ConvertFromUtf32(i) + "</u>";
lbtnCharacters.ID = Char.ConvertFromUtf32(i);
lbtnCharacters.CommandArgument = Char.ConvertFromUtf32(i);
lbtnCharacters.CommandName = "AlphaPaging";
lbtnCharacters.CssClass = "firstCharacter";
lbtnCharacters.Click += new EventHandler(lbtnAlphabets_Click);
alphabets.Controls.Add(lbtnCharacters);
}
As there are multiple link buttons so i have assigned unique id to them but i am not getting how to access them in other functions in code behind.and one more thing the “alphabet” to which i am adding all linkbutton is a div can anybody tell me how i can access them
If you want to access them in CodeBehind, your only real option is to use
FindControl: