I have contentpage overriding the OnInit event of a masterpage. The override works fine, until I put a custom user control on the page: in this case the OnInit event does not fire for the contentpage (no overrides are used in the user control)
What are the possible causes/solutions for this? (I use the OnInit event to create dynamic controls)
Edit:
now i tried this in the content page:
(The OnPreInit part runs, but Masters_Init does not get called…)
protected override void OnPreInit(EventArgs e) { base.Master.Init += new EventHandler(Masters_Init); } void Masters_Init(object sender, EventArgs e) { //code }
Are you calling the base.OnInit?
Update
Also as mentioned in the comments I would recommend not overriding the events if you don’t have to, but if you must be sure to call the base. so in your edit above it should be