Skip to main content
.NET Framework 4.5.2+
  • The page you are viewing does not exist in the .NET 6.0+ platform documentation. This link will take you to the parent topic of the current section.

WebWindow.CustomRegisterTemplateDependentScripts Event

Occurs when ASP.NET Web Forms Template’s scripts are registered.

Namespace: DevExpress.ExpressApp.Web

Assembly: DevExpress.ExpressApp.Web.v23.2.dll

NuGet Package: DevExpress.ExpressApp.Web

Declaration

public event EventHandler<CustomRegisterTemplateDependentScriptsEventArgs> CustomRegisterTemplateDependentScripts

Event Data

The CustomRegisterTemplateDependentScripts event's data class is DevExpress.ExpressApp.Web.CustomRegisterTemplateDependentScriptsEventArgs.

Remarks

Handle the CustomRegisterTemplateDependentScripts to register custom scripts. The snippet below illustrates how to implement the Controller that subscribes to this event.

public class RegisterCustomScriptsController : Controller {
    private void window_CustomRegisterTemplateDependentScripts(
        object sender, CustomRegisterTemplateDependentScriptsEventArgs e) {
        WebWindow window = (WebWindow)sender;
        e.Handled = true;
        e.Page.ClientScript.RegisterClientScriptResource(GetType(), 
            "MySolution.Module.Web.Resources.TemplateScripts.js");
        e.Page.ClientScript.RegisterClientScriptResource(GetType(), 
            "MySolution.Module.Web.Resources.MoveFooter.js");
    }
    protected override void OnFrameAssigned() {
        base.OnFrameAssigned();
        WebWindow window = Frame as WebWindow;
        if(window != null) {
            window.CustomRegisterTemplateDependentScripts += 
                new EventHandler<CustomRegisterTemplateDependentScriptsEventArgs>(
                    window_CustomRegisterTemplateDependentScripts);
        }
    }
    protected override void OnDeactivated() {
        WebWindow window = Frame as WebWindow;
        if(window != null) {
            window.CustomRegisterTemplateDependentScripts -= 
                new EventHandler<CustomRegisterTemplateDependentScriptsEventArgs>(
                    window_CustomRegisterTemplateDependentScripts);
        }
        base.OnDeactivated();
    }
}

The complete example is available in the FeatureCenter demo.

See Also