Вопрос

Я пытаюсь сочувствовать отношение radwindow / radwindowmanager.Я вижу, что могут быть много элементов управления RadwindowManager, определенные на одной странице (в отличие от RADScriptManager / ScriptManager, который требует одной реализации).Но я также вижу, что мы можем реализовать радиWindow внутри RadwindowManager или в качестве автономного управления.

Каковы преимущества использования RadwindowManager рядом с возможностью применения настроек, определенных на диспетчере к окну?Лучше сохранить RadwindowManager за пределами главной страницы и определить его, где он нужен, или лучше сохранить глобальный RadwindowManager, и иметь Radwindow в качестве автономного управления?

спасибо.

Это было полезно?

Решение

Using RadWindowManager is simply a convenient way to declare common properties for multiple windows on your page. You can declare multiple RadWindow controls within a RadWindowManager, then access the collection of windows via the following functions:

var windowManager = $find('<%= MyRadWindowManager.ClientID %>'),
    windows = windowManager.get_windows(),
    wnd,
    i = 0;
for (; i < windows.length; i++) {
    wnd = windows[i];
    // do something with the RadWindow object
}

Be careful not to call the RadWindow variable "window", as it would conflict with the global window object.

If you want a specific RadWindow object, you can use the following code:

var windowManager = $find('<%= MyRadWindowManager.ClientID %>'),
    wnd = windowManager.getWindowByName("MyWindow");
// do something with the RadWindow object

Or, what I prefer is to define a single RadWindowManager in my Master page, with no windows defined, and then simply use it to open windows dynamically as needed. Here's an example:

<telerik:RadWindowManager ID="MasterWindowManager" runat="server" 
    VisibleOnPageLoad="false"
    VisibleStatusbar="false" 
    Behaviors="Close, Move" 
    DestroyOnClose="true" >
</telerik:RadWindowManager>

Defining a RadWindowManager on your Page will add a radopen function to the global window object. You can use it to dynamically open new RadWindows as needed...

var showCustomerDetails = function (customerId) {
    var url = String.format("/Views/CustomerDetails.aspx?cid={0}", customerId),
        wnd = window.radopen(url);
    wnd.set_modal(true);
    wnd.setSize(600, 400);
    wnd.show();
    wnd.center();
}

I hope that helps.

Другие советы

I just answered your forum thread in Telerik's forums, but for convenience I am pasting my reply below, as an addition to Kevin's reply.

Basically, the idea behind the RadWindowManager is to allow the users to create on the client multiple RadWindows with pre-defined properties, set in the manager. The manager's client-side API allows the developer to easily get a reference to such RadWindows and to operate with them. There are a couple of things however, that should be kept in mind when using RadWindowManager.

1.. In case you have multiple RadWindowManagers on the same page:

 All RadWindowManager's functions (radopen, radalert, radconfirm, radprompt, GetRadWindowManager, etc) are always using the first rendered RadWindowManager on the page.
 Every RadWindowManager "knows" only the RadWindows that are declared in its Windows collection.

This means that if you have a RadWindow2 as a standalone control OR declared in RadWindowManager2, and you use something like radopen(myUrl, "RadWindow2");, radopen will use RadWindowManager1 and will open a new RadWindow with the settings taken from RadWindowManager1. To avoid that problem, when you have multiple managers on a page, you need to get a reference to the correct RadWindowManager first and then call its methods. e.g. var manager = $find("<%= RadWindowManager2.ClientID %>"); manager.open(myUrl, "RadWindow2");

2.. Standalone RadWindow controls cannot be controlled by RadWindowManager - they are separate controls and are not affected by manager's settings.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top