WebApplication.ControlsCreating Event
Occurs before creating controls for the Web Forms page.
Namespace: DevExpress.ExpressApp.Web
Assembly: DevExpress.ExpressApp.Web.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Web
Declaration
Event Data
The ControlsCreating event's data class is ControlsCreatingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Page | Gets the Web Forms page. |
Remarks
The ControlsCreating event is raised as the result of executing the WebApplication.CreateControls method. Handle this event to access a Page object, before its controls are created. This object is accessible via the ControlsCreatingEventArgs.Page parameter.
using DevExpress.ExpressApp.Web;
// ...
public class MyController : Controller {
protected override void OnActivated() {
base.OnActivated();
((WebApplication)Application).ControlsCreating += Instance_ControlsCreating;
}
private void Instance_ControlsCreating(object sender, ControlsCreatingEventArgs e) {
// Access the Page object via the e.Page parameter:
e.Page.PreRender += Page_PreRender;
// ...
}
// ...
protected override void OnDeactivated() {
WebApplication webApplication = ((WebApplication)Application);
if(webApplication != null) {
webApplication.ControlsCreating -= Instance_ControlsCreating;
}
base.OnDeactivated();
}
}
See Also