Hi All;
I have created a few dynamic controls within the Page_Load event, like so:
The command event handler code I am trying to add to these links is below:
It compiles and runs fine, but when I click on one of my dynamically added links the LinkButton1_Command isn't being called.
Is there something I am doing wrong?
Thanks for any and all help!
Sean.![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
I have created a few dynamic controls within the Page_Load event, like so:
Code:
LinkButton lnkSet = new LinkButton();
lnkSet.ID = "lnkSet" + i.ToString();
lnkSet.Text = "Lot " + iStart + " - " + (iStart + iIncrement).ToString();
lnkSet.Command += new CommandEventHandler(this.LinkButton1_Command);
lnkSet.CommandName = "Prev";
lnkSet.CommandArgument = i.ToString();
phLotLinks.Controls.Add(lnkSet);
The command event handler code I am trying to add to these links is below:
Code:
protected void LinkButton1_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "Prev")
LoadPrev();
else if (e.CommandName == "Next")
LoadNext();
SetupLinks(int.Parse(e.CommandArgument.ToString()), int.Parse(hdnCount.Value));
}
It compiles and runs fine, but when I click on one of my dynamically added links the LinkButton1_Command isn't being called.
Is there something I am doing wrong?
Thanks for any and all help!
Sean.
![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)