WindowBehaviors enums declaration

2 posts, 1 answers
  1. Dave
    Dave avatar
    21 posts
    Member since:
    Jul 2012

    Posted 30 Mar 2013 Link to this post

    Is there a way to get the WindowBehaviors enums defined without a RadWindowManager declaration?    From script on a page, I call a function in an iframe and want to pass in the behavior as a parameter.  The calling page has no need to declare the RadWindowManager, except to get the definition of the enums, i.e. Telerik.Web.UI.WindowBehaviors.Move.   I can set up my own enums within the calling page, but would prefer to use the Telerik defs.  
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 02 Apr 2013 Link to this post

    Hello Dave,

    This is the code that can register an enum with JavaScript:
    $ = $telerik.$;
    $.registerEnum(Telerik.Web.UI, "WindowBehaviors", {
        None: 0,
        Resize: 1,
        Minimize: 2,
        Close: 4,
        Pin: 8,
        Maximize: 16,
        Move: 32,
        Reload: 64,
        Default: (1 + 2 + 4 + 8 + 16 + 32 + 64)
    });

    What this does is extend the Telerik.Web.UI class with the WindowBehaviors enum.

    What I can also suggest is using the numerical values instead of an enum if it fits your needs, e.g.:
    var wnd = $find("RadWindow1");
    wnd.set_behaviors(4);
    will be equivalent to
    var wnd = $find("RadWindow1");
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);


    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top