This is a migrated thread and some comments may be shown as answers.

WindowBehaviors enums declaration

1 Answer 77 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 30 Mar 2013, 07:48 PM
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.  

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 02 Apr 2013, 10:36 AM
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.
Tags
Window
Asked by
Dave
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or