More info about this.
In the master page i havebthe code:
Control wpCtl = this.LoadControl(userControl);
wpCtl.ID = System.
Guid.NewGuid().ToString();GenericWebPart gwp = this.sunWebPartManager.CreateWebPart(wpCtl);
gwp.Title = webPartTitle;
this.sunWebPartManager.AddWebPart(gwp, wpz, 0);
So, my controls are added dynamically. So when the LoadControl will be executed the Page_Load will occur on the ascx.
I found a workaround. Before the LoadControl I write in the Sessioon a Key, and imediately after that is done, i remove that key. On the Page_Load in the user control i check the Session Key. In this way i do the InitUI only in the first normal load, not when the LoadControl is occured.
I really do not like this approach. Any other more elegant ideea???
Yours,
Popa D. Stelian
MCP/MCAD/MCSD
ROMANIA