# Positioning

You can dynamically adjust the position of the Window by using its [API](https://www.telerik.com/aspnet-mvc/documentation/api/window).

Usually, it is preferable to center the Window rather than open it near the HTML element which is used to define its content. Often, the Window is opened as a result of a user action rather than of the `load` event of the page. Basically, the widget can be initialized as non-visible and can be opened when needed.

## Centered Window

The following example demonstrates how to center and open a Window component with a button click. If the Window's content is loaded through AJAX, [the centering occurs after the request is complete](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/layout/window/loading-content#load-on-demand-content).

```Razor HtmlHelper
    @(Html.Kendo().Window()
        .Name("window")
        .Title("Centered Window")
        .Visible(false)
        .Width(200)
        .Height(200)
        .Content(@<text>
                Window content here.
        </text>)
    )

    @(Html.Kendo().Button()
        .Name("button")
        .Content("Open Window")
        .Events(e => e.Click("onClick"))
    )
```

```JavaScript

    <script>
        function onClick(e) {
            var win = $("#window").data("kendoWindow");
            win.center().open();
        }
    </script>

```

## Custom Positioned Window

To set a custom position of the Window, use the [`Position()`](https://docs.telerik.com/aspnet-mvc/api/kendo.mvc.ui.fluent/windowbuilder#positionsystemaction) option.

```Razor HtmlHelper
@(Html.Kendo().Window()
    .Name("window")
    .Title("Custom Positioned Window")
    .Position(settings =>
        settings.Top(50).Left(100)
    )
    .Content(@<text>
        Window content here.
    </text>)
)
```

## See Also

* [Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/window)
* [Client-Side API](https://docs.telerik.com/kendo-ui/api/ui/window)
