How can I add an Async trigger button for an UpdatePanel Programatically?

InvD

New Member
I know that similar questions have been asked previously, however I haven't been able to locate a thread that could resolve my problem:I'm trying to add a button programatically, make it a trigger for my UpdatePanel and eventually wire an event to it. Basically, I'm willing to add an "Edit" button for each row I read from a DB.I've done the following:\[code\]TableCell actions = new TableCell();Button editBTN = new Button();editBTN.ID = "editBTN";editBTN.Text = "Edit";editBTN.Click += new EventHandler(this.editBTN_Click);AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();trigger.ControlID = "editBTN";trigger.EventName = "editBTN_Click";UpdatePanel1.Triggers.Add(trigger);actions.Controls.Add(editBTN);\[/code\]All of the above is in a method which worked perfectly before I tried so. The below method is the event method:\[code\]protected void editBTN_Click(object sender, EventArgs e){ //Do my stuff here...}\[/code\]Please also note that this very same UpdatePanel works fine when I just use a trigger I declare within the ASPX file and not programatically. There must be something I'm missing with the line of events upon Page_load or something like that.The error I get:Could not find an event named 'testevent' on associated control 'editBTN' for the trigger in UpdatePanel 'UpdatePanel1'.Any help would be greatly appreciated, thanks.
 
Back
Top