Wednesday 20 February 2008

MOSS 2007 Webpart Control Events not Firing

I found this an 'interesting one'.

protected override void CreateChildControls()
{
try
{
PopulateDataTable();
CreateDropDown();
base.CreateChildControls();
}
catch(Exception ex)
{...}
}

When creating a Webpart and I had the events wired up in the CreateDropDown() they would not fire but when I moved them into the CreateChildControls() they did!

All the CreateDropDown() did was populate a drop down from the table created in the PopulateDataTable() and wire up the Click event.

I haven't found an answer yet as to why this would happen but I'll look into it later but it worked for me.

No comments: