ASP.NET webpart page load firing for all webparts in DeclarativeCatalogPart
Greetings.
I have a bunch of ASP.NET webparts added to the WebPartsTemplate sectio开发者_开发知识库n of a DeclarativeCatalogPart. These webparts are classic ASP.NET User Controls (ascx) that implement System.Web.UI.WebControls.WebParts.IWebPart.
I discovered that the page load event is firing for all controls added to the DeclarativeCatalogPart REGARDLESS of whether or not the user has actually added the control to a visible WebPartZone.
Is there a way to only have Page Load fire in the ascx webparts when the webparts are added to a WebPartZone by a user? Converesely, how can I NOT have the Page Load event fire for all webparts declared in the DeclarativeCatalogPart?
why don't you just check on Page_Load if the web part is visible if not then just return from Page_Load.
精彩评论