How to: Center PopUp Edit Form in RadTreeList

3 posts, 1 answers
  1. Thanh
    Thanh avatar
    2 posts
    Member since:
    Jul 2010

    Posted 29 Sep 2011 Link to this post

    Following are the lines from my HTML page.  I want to control the position of popup window duing add/edit.
    It should be center align to the screen/browser window.  How do set it ?
  2. Answer
    Veli avatar
    2002 posts

    Posted 03 Oct 2011 Link to this post

    Hello Thanh,

    You can use the client-side OnTreeListCreated event that will fire when the RadTreeList client component is loaded on the page. Inside the event handler, you can find the first popup edit form (with a CSS class of "rtlEditForm"). Finally, jQuery or another approach can help you calculate the position of the element relative to the viewport. Here is a text page:

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <telerik:RadTreeList ID="RadTreeList1" runat="server">
                <ClientEvents OnTreeListCreated="treeListCreated" />
        <script type="text/javascript">
            (function($) {
                $ = function () {
                    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
                    this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
                    return this;
            function treeListCreated(sender, args) {
                $telerik.$(".rtlEditForm", sender.get_element()).center();               

    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. Thanh
    Thanh avatar
    2 posts
    Member since:
    Jul 2010

    Posted 12 Oct 2011 Link to this post

    Thank you Veli.
Back to Top