Skip to main content
A newer version of this page is available. .

WebWindow.CustomRegisterTemplateDependentScripts Event

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

Namespace: DevExpress.ExpressApp.Web

Assembly: DevExpress.ExpressApp.Web.v19.1.dll

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