c# - programmatically hooked-up event not firing? -



c# - programmatically hooked-up event not firing? -

i'm creating table containing couple of buttons. these buttons hookup events firing method updating specific database item. somekind of reason event isn't proper hooked-up. method should executed isn't executed @ all. doing wrong

pseudo code:

public void createtable(list<bll> itemlist) { //newtable; foreach (bll item in itemlist) { //newrow; //create multiple cells... tablecell cell = new tablecell(); button button = new button(); button.id = "buttonname" + counter.tostring(); button.text = "update"; button.click += new system.eventhandler(this.updatebutton_click); cell.controls.add(button); //addcelltotablerow } //addrowtotable } public void updatebutton_click(object sender, eventargs e) { //logic sender , update database. //debugger doesn't breakpoint here. }

you need read on asp.net page life cycle.

when create dynamic controls, need recreate them on every post - best done in oninit event handler.

if not so, objects , attached events not exist, events not fire on them.

c# asp.net events

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -